Recent Updates Toggle Comment Threads | Keyboard Shortcuts

  • Ady Romantika 1:30 pm on December 13, 2017 Permalink | Reply
    Tags: aws   

    aws cli put-bucket-lifecycle-configuration MalformedXML 

    Lifecycle configuration:

    {
      "Rules": [
        {
          "ID": "ArchiveRule",
          "Status": "Enabled",
          "Transitions": [
            {
              "Days": 90,
              "StorageClass": "STANDARD_IA"
            },
            {
              "Days": 180,
              "StorageClass": "GLACIER"
            }
          ]
        }
      ]
    }
    

    Command:

    aws s3api put-bucket-lifecycle-configuration --bucket $bucket --lifecycle-configuration file://lifecycle.json

    Output:

    An error occurred (MalformedXML) when calling the PutBucketLifecycleConfiguration operation: The XML you provided was not well-formed or did not validate against our published schema
    exit status 255
    

    Solution:

    It turns out the Filter element is necessary as described in http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTlifecycle.html

     

    New lifecycle configuration:

    {
      "Rules": [
        {
          "ID": "ArchiveRule",
          "Status": "Enabled",
          "Filter": {
            "Prefix": ""
          },
          "Transitions": [
            {
              "Days": 90,
              "StorageClass": "STANDARD_IA"
            },
            {
              "Days": 180,
              "StorageClass": "GLACIER"
            }
          ]
        }
      ]
    }
    
     
  • Ady Romantika 6:25 pm on November 29, 2017 Permalink | Reply
    Tags:   

    List All Trusted Certificate Authorities (CA) on Linux 

    Debian 8

    awk -v cmd='openssl x509 -noout -subject' '
     /BEGIN/{close(cmd)};{print | cmd}' < /etc/ssl/certs/ca-certificates.crt

    Amazon Linux

    awk -v cmd='openssl x509 -noout -subject' '
    /BEGIN/{close(cmd)};{print | cmd}' < /etc/ssl/certs/ca-bundle.trust.crt
    

    The Amazon Linux file is probably the same as other RedHat derivatives.

     
  • Ady Romantika 5:20 pm on June 28, 2016 Permalink | Reply
    Tags:   

    Atom Behind Corporate Proxy 

    I’ve never really have to work from behind any proxy before, so a new Atom installation quickly fails when installing packages. The answer is to run these:

      apm config set proxy "http://proxy:port"
      apm config set https_proxy proxy "http://proxy:port"

    If your proxy is crazy like mine:

      apm config set strict-ssl false
    

    I tested these on Windows 7, not sure about other platforms.

     
  • Ady Romantika 1:22 pm on December 10, 2014 Permalink | Reply
    Tags:   

    Recent Photos on OS X 

    ~/Library/Containers/com.apple.ImageKit.RecentPictureService/Data/Library/Images/Recent Pictures/

     
  • Ady Romantika 1:43 am on March 2, 2014 Permalink | Reply
    Tags: ,   

    dnsmasq stop-dns-rebind 

    My current team uses Amazon’s Route 53 to define addresses to local test machines, and I’ve been wondering why my dnsmasq on my DD-WRT is returning blank for addresses that resolves to private IP ranges.

    The answer is the option “stop-dns-rebind”. Disable that, and it works.

    In the web GUI, the option is called “No DNS Rebind” and it’s located in the “Services” tab and sub-tab.

     
  • Ady Romantika 9:41 pm on February 26, 2014 Permalink | Reply
    Tags: Digital Ocean   

    Remember that Digital Ocean’s Ubuntu droplets are set to use EST timezone as default.

    On a separate note: love the SG droplets!

     
  • Ady Romantika 4:39 pm on January 7, 2014 Permalink | Reply
    Tags:   

    Debian 6.0 RAID and GRUB 

    One of the three hard disk failed on the ancient Linux firewall at the office. It had all disks configured into one logical volume.

    Two other disks are fine, so I decided to pair them into RAID 1. To save time, I’m using the Debian 6.0 DVD found in the office.

    All went well until it’s time to install GRUB. It turned out, mdmadm wasn’t installed on the target system.

    chroot /target apt-get install mdmadm
    chroot /target grub-install /dev/sda
    chroot /target grub-install /dev/sdb
    

    Installing GRUB on both MBR will ensure that the machine will be able to boot even if one of the disks fails. At least, that’s the theory. Will test if time permits.

     
  • Ady Romantika 12:26 pm on January 5, 2014 Permalink | Reply
    Tags:   

    Restore Time Machine Backup from Third Party NAS 

    Upgraded my hard disk, and restored from a Time Machine backup. Used DiskMakerX to create Mavericks install USB disk a while ago.

    Before doing anything it’s handy to have:

    1. Username, password, and IP number of the NAS (especially if helping someone else)
    2. Lots of time. Once it starts restoring we can leave it running. To get it into perspective, my 200GB backup was restored in 13 hours on a 100Mbps connection. No gigabit connection here.

    To make sure the restore utility finds the backup, open terminal after booting from the installation media:

    cd /Volumes
    mkdir TimeMachine
    mount -t afp afp://<username>:<password>@<ip_address>/Volumes/TimeMachine
    hdid /Volumes/TimeMachine/<backup_name>.sparsebundle
    

    Close terminal, go to the restore utility and the time machine backup should be there.

     
  • Ady Romantika 12:45 am on December 2, 2013 Permalink | Reply
    Tags:   

    Check Open Port(s) 

    I usually use telnet, but if it’s not available but netcat (nc) is available:

    nc -v -w 1 <IP_address_or_hostname> -z <Port_or_Range_of_ports>
    

    So if I’d like to see whether port 20-22 is available on a fictitious hostname target.something.com

    nc -v -w 1 target.something.com -z 20-22
    
     
  • Ady Romantika 12:59 am on November 26, 2013 Permalink | Reply
    Tags:   

    Nullrouting 

    route add x.x.x.x gw 127.0.0.1 lo
    

    OR

    route add -host x.x.x.x reject
    
     
  • Ady Romantika 8:05 pm on November 11, 2013 Permalink | Reply
    Tags:   

    LaTeX in WordPress 

    It looks like LaTeX formula needs to be entered in text mode editor instead of HTML (a.k.a. visual) editor.

    $latex i\hbar\frac{\partial}{\partial t}\left|\Psi(t)\right&gt;=H\left|\Psi(t)\right&gt;$
    

    i\hbar\frac{\partial}{\partial t}\left|\Psi(t)\right>=H\left|\Psi(t)\right>

     
  • Ady Romantika 6:10 pm on November 8, 2013 Permalink | Reply
    Tags: Plan, WordPress   

    Plans Plans Plans 

    Current Plans

    1. WordPress: Combine all WordPress blogs to multisite.
    2. WordPress: Make sure current and future plugins are multisite compatible.
    3. WordPress: Peek into contributing into core.
    4. PHP: ms_MY manual
    5. PHP/C++: Continue working on the libphonenumber extension.

    Number 3 has been in the planned list since 2005. I have been to intimidated by the old timers. Let’s see what happens.

     
  • Ady Romantika 11:12 am on November 6, 2013 Permalink | Reply
    Tags: ,   

    Pear on MacPorts 

    Install:

    sudo port install php5 +pear
    

    Make sure paths are correctly pointing to /opt/local

    sudo port config-show
    
     
  • Ady Romantika 5:09 pm on November 1, 2013 Permalink | Reply
    Tags:   

    ldd on OS X 

    otool -L /opt/bin/git
    
    /opt/bin/git:
    	/opt/local/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.8)
    	/opt/local/lib/libiconv.2.dylib (compatibility version 8.0.0, current version 8.1.0)
    	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
    
     
  • Ady Romantika 12:40 am on October 30, 2013 Permalink | Reply
    Tags:   

    Deep C 

     
  • Ady Romantika 4:12 pm on October 29, 2013 Permalink | Reply
    Tags: build, , libphonenumber,   

    libphonenumber 

    https://github.com/adyromantika/vagrant-libphonenumber-build

    Built a new C++ PHP extension referencing libphonenumber, crashed with segmentation fault. Might have something to do with x86_64, still investigating. The annoying part is that the block that crashes it is:

    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &num) == FAILURE)
         RETURN_NULL();
    

    If argument parsing is omitted and parameters hardcoded, the function is able to return expected result.

    Attempted to use 32 bit machine, but libphonenumber build fails:

    [ 74%] Building CXX object CMakeFiles/libphonenumber_test.dir/test/phonenumbers/geocoding/phonenumber_offline_geocoder_test.cc.o
    /home/vagrant/libphonenumber-read-only/cpp/test/phonenumbers/geocoding/phonenumber_offline_geocoder_test.cc:61:5: error: this decimal constant is unsigned only in ISO C90 [-Werror]
    /home/vagrant/libphonenumber-read-only/cpp/test/phonenumbers/geocoding/phonenumber_offline_geocoder_test.cc:63:5: error: this decimal constant is unsigned only in ISO C90 [-Werror]
    cc1plus: all warnings being treated as errors
    make[2]: *** [CMakeFiles/libphonenumber_test.dir/test/phonenumbers/geocoding/phonenumber_offline_geocoder_test.cc.o] Error 1
    make[1]: *** [CMakeFiles/libphonenumber_test.dir/all] Error 2
    make: *** [all] Error 2
    

    Also, Ubuntu precise has PHP 5.3

     
    • Ady Romantika 11:15 am on November 6, 2013 Permalink | Reply

      Since we expect a string, the string length is required.

      if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &num, &num_len) == FAILURE)
           RETURN_NULL();
      
  • Ady Romantika 2:37 pm on October 27, 2013 Permalink | Reply
    Tags:   

    I wish that the right hand box labeled “Sidebar” in the Widgets settings page follows the page scroll. It’s quite inconvenient to drag new widgets into it.

     
    • Ady Romantika 5:16 am on November 2, 2013 Permalink | Reply

      Workaround: Drag the new widget from “Available Widgets” into “Inactive Widgets”, customize and save it, collapse “Available Widgets” so that the “Inactive Widgets” is right next to the “Sidebar”. It’s now closer to drag.

  • Ady Romantika 2:30 pm on October 27, 2013 Permalink | Reply
    Tags: ,   

    Checksum Mismatch 

    Using OpenDNS

    sudo port upgrade outdated
    ---> Fetching archive for apr
    Warning: Your DNS servers incorrectly claim to know the address of nonexistent hosts. This may cause checksum mismatches for some ports.
    

    Upgrading, received an error:

    The file has been moved to: /opt/local/var/macports/distfiles/file/file-5.15.tar.gz.html
    Error: org.macports.checksum for port libmagic returned: Unable to verify file checksums
    

    Downloaded the file manually and the upgrade continues. Removed OpenDNS from my dnsmasq.

     
  • Ady Romantika 4:20 am on October 27, 2013 Permalink | Reply
    Tags: ,   

    MacPorts on Mavericks 

    Attempt to upgrade MacPorts (to 2.2.1) after Mavericks failed:

    checking for Tcl configuration...
    configure: error: Can't find Tcl configuration definitions
    

    Remedy: Install command line tools

    xcode-select --install
    

    The install command line tools button is no longer there in Xcode.

    ReferenceAutodetection Tcl config variables fail on 10.9

     
c
Compose new post
j
Next post/Next comment
k
Previous post/Previous comment
r
Reply
e
Edit
o
Show/Hide comments
t
Go to top
l
Go to login
h
Show/Hide help
shift + esc
Cancel