Skip to content

Instantly share code, notes, and snippets.

View dossy's full-sized avatar
🍪
derping around

Dossy Shiobara dossy

🍪
derping around
View GitHub Profile
@dossy
dossy / xml.go
Last active March 16, 2018 11:18
General-purpose XML parsing in Go
/*
https://play.golang.org/p/3g50cX2ed-
Output looks like:
&main.Node{XMLName:xml.Name{Space:"", Local:"foo"}, Comments:" a b ", Attrs:[]xml.Attr(nil), Value:"", Children:[]main.Node{main.Node{XMLName:xml.Name{Space:"", Local:"bar"}, Comments:"", Attrs:[]xml.Attr{xml.Attr{Name:xml.Name{Space:"", Local:"baz"}, Value:"bing"}}, Value:"", Children:[]main.Node(nil)}}}
*/
package main
@dossy
dossy / ntpdate.plist
Created July 5, 2017 15:11
/Library/LaunchDaemon/ntpdate.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>ntpdate</string>
<key>Disabled</key>
<false/>
<key>UserName</key>
<string>root</string>
@dossy
dossy / git.md
Last active January 9, 2016 21:30
Handy git tricks

Handy Git Tricks

Get branches, sorted by last commit

Local:

$ git for-each-ref --sort=-committerdate --format='%(committerdate:iso8601)  %(objectname:short)  %(refname)' refs/heads
@dossy
dossy / aws-snapshot-backup.sh
Created December 31, 2015 03:37
Create snapshots of current EC2 instance's volumes.
#!/bin/bash
if [ -z "$AWS_CREDENTIALS" ]; then
AWS_CREDENTIALS="$HOME/.aws/credentials"
fi
if [ ! -e "$AWS_CREDENTIALS" ]; then
echo "$AWS_CREDENTIALS missing; use 'aws configure'."
exit
fi
alter table wp_posts drop index yarpp_content;
alter table wp_posts modify post_content longtext character set latin1;
alter table wp_posts modify post_content longtext character set binary;
alter table wp_posts modify post_content longtext character set utf8mb4 collate utf8mb4_unicode_ci;
alter table wp_posts default character set utf8mb4 collate utf8mb4_unicode_ci;
alter table wp_posts add fulltext index yarpp_content (post_content);
@dossy
dossy / # node - 2015-12-14_14-09-08.txt
Created December 14, 2015 19:13
node on OS X 10.7.5 - Homebrew build logs
Homebrew build logs for node on OS X 10.7.5
Build date: 2015-12-14 14:09:08
@dossy
dossy / patch_inotify_init1.c
Created November 27, 2015 18:43
Running CrashPlan on older Linux
/*
* $ gcc -Wall -shared -fPIC -o patch_inotify_init1.so patch_inotify_init1.c
*
* LD_PRELOAD=patch_inotify_init1.so java ...
*
* [11.27.15 12:43:37.040 ERROR main .service.backup.BackupController] Exception setting up BackupController! , java.lang.UnsatisfiedLinkError: Error looking up function 'inotify_init1': /usr/local/crashplan/jre/bin/java: undefined symbol: inotify_init1
* STACKTRACE:: java.lang.UnsatisfiedLinkError: Error looking up function 'inotify_init1': /usr/local/crashplan/jre/bin/java: undefined symbol: inotify_init1
* at com.sun.jna.Function.<init>(Function.java:208)
* at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:536)
* at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:513)
@dossy
dossy / dd-iso.sh
Created November 25, 2014 20:10
Creating and burning ISOs on OSX command line
$ diskutil list
$ sudo umount /dev/disk3
$ dd if=/dev/disk3 of=image.iso bs=2048 conv=sync,notrunc
$ hdiutil burn image.iso