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
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 / 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
@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 / 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 / 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 / gawk-split-mysqldump.sh
Last active June 25, 2018 15:46
split mysqldump with gawk
gawk 'BEGIN { F="_"; } match($0, /^-- (Table|Temporary table) structure for (table|view) `(.*)`/, m) { close(F ".sql"); F=m[3]; } { print $0 > F ".sql"; }'
@dossy
dossy / snippet.html
Last active October 29, 2022 14:01
Disable submit buttons on Gravity Forms when required fields are empty
<script type="text/javascript">
// don't forget to add a style for:
// `input[type="submit"].disabled, input[type="submit"].button-disabled, input[type="submit"]:disabled`
jQuery(function ($) {
$('form[id^="gform_"]').on('change', function (e) {
var $reqd = $(this).find('.gfield_contains_required.gfield_visibility_visible').filter(function (i, c) {
return []
.concat($(c).find('input[type="text"], textarea').filter(function (i, fl) { return $(fl).val().length == 0; }).get())
.concat($(c).find('input[type="checkbox"]').not(':checked').get())
.length;
@dossy
dossy / keybase.md
Created December 14, 2019 16:26
Keybase proof

Keybase proof

I hereby claim:

  • I am dossy on github.
  • I am dossy (https://keybase.io/dossy) on keybase.
  • I have a public key whose fingerprint is C535 6302 1171 987D 738E BFD8 2B1A B2E1 8D97 40AA

To claim this, I am signing this object: