Backtick.io - Save to Pinboard
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Step 1: Fill in EMAIL, TOKEN, DOMAIN and SUBDOMAIN. Your API token is here: https://dash.cloudflare.com/profile/api-tokens | |
# Make sure the token is the Global token, or has these permissions: #zone:read, #dns_record:read, #dns_records:edit | |
# If you want to set the root domain instead of a subdomain, set SUBDOMAIN to "@" | |
# Step 2: Create an A record on Cloudflare with the subdomain you chose | |
# Step 3: Run "./ddns.sh -l" to get the zone_id and rec_id of the record you created. | |
# Fill in ZONE_ID and REC_ID below | |
# This step is optional, but will save you 2 requests every time you run this script | |
# Step 4: Run "./ddns.sh". It should tell you that record was updated or that it didn't need updating. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Requires git 1.8.2 or newer | |
# Prevents force-pushing or deleting a special branch (e.g. master). | |
# Based on: https://gist.github.com/pixelhandler/5718585 and https://gist.github.com/stefansundin/d465f1e331fc5c632088 | |
# Install: | |
# cd path/to/git/repo | |
# curl -fL -o .git/hooks/pre-push https://gist.githubusercontent.com/lyoshenka/158cfff41d09e1dcf029/raw/pre-push.sh | |
# chmod +x .git/hooks/pre-push |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#### | |
# Split MySQL dump SQL file into one file per table | |
# based on http://blog.tty.nl/2011/12/28/splitting-a-database-dump | |
#### | |
if [ $# -ne 1 ] ; then | |
echo "USAGE $0 DUMP_FILE" | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
full_data = { | |
response: {body: StyledYAML.literal(DATA.read), status: 200}, | |
person: StyledYAML.inline('name' => 'Steve', 'age' => 24), | |
array: StyledYAML.inline(%w[ apples bananas oranges ]) | |
} | |
StyledYAML.dump full_data, $stdout | |
__END__ | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Clone or update all a user's gists | |
# curl -ks https://gist.githubusercontent.com/lyoshenka/de4d3a0e82d8be987d69/raw/gist-backup.py | python | |
# curl -ks https://gist.githubusercontent.com/lyoshenka/de4d3a0e82d8be987d69/raw/gist-backup.py | USERNAME=lyoshenka python | |
# USERNAME=lyoshenka python gist-backup.py | |
import json | |
import urllib | |
from subprocess import call | |
from urllib import urlopen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* $.unserialize | |
* | |
* Takes a string in format "param1=value1¶m2=value2" and returns an object { param1: 'value1', param2: 'value2' }. If the "param1" ends with "[]" the param is treated as an array. | |
* | |
* Example: | |
* | |
* Input: param1=value1¶m2=value2 | |
* Return: { param1 : value1, param2: value2 } | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html><head> | |
<meta charset="utf-8" /> | |
<title>Site Maintenance</title> | |
<style type="text/css"> | |
body { padding: 50px 30px 30px; font: 20px Helvetica, sans-serif; color: #222; line-height: 1.4 } | |
h1 { font-size: 40px; } | |
article { text-align: left; max-width: 650px; margin: 0 auto; } | |
a { color: #dc8100; padding: 3px } | |
a:hover { color: #fff; background-color: #dc8100 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
head -n100 /dev/urandom | strings | egrep -o '([a-zA-Z0-9#%&^])' | awk '{ORS=""; print $1}' | head -c 35; echo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Latency Comparison Numbers | |
-------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
NewerOlder