$ ./githubapi-get.sh $GITHUBTOKEN /users/mbohun/repos
HTTP/1.1 200 OK
Server: GitHub.com
Date: Wed, 04 Mar 2015 04:30:29 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 155683
Status: 200 OK
#!/bin/sh -e | |
hostname=$1 | |
device=$2 | |
file=$HOME/.dynv6.addr6 | |
[ -e $file ] && old=`cat $file` | |
if [ -z "$hostname" -o -z "$token" ]; then | |
echo "Usage: token=<your-authentication-token> [netmask=64] $0 your-name.dynv6.net [device]" | |
exit 1 | |
fi |
$ ./githubapi-get.sh $GITHUBTOKEN /users/mbohun/repos
HTTP/1.1 200 OK
Server: GitHub.com
Date: Wed, 04 Mar 2015 04:30:29 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 155683
Status: 200 OK
(* note that in order to preserve certain order | |
and also show the conciseness of the implementation, | |
no tail-recursive is used *) | |
let ins_all_positions x l = | |
let rec aux prev acc = function | |
| [] -> (prev @ [x]) :: acc |> List.rev | |
| hd::tl as l -> aux (prev @ [hd]) ((prev @ [x] @ l) :: acc) tl | |
in | |
aux [] [] l | |
import sys | |
import markdown | |
import yaml | |
import os | |
from jinja2 import Environment, FileSystemLoader | |
with open(sys.argv[2], 'r') as f: | |
content = yaml.safe_load(f.read()) | |
for k in content: |
#!/bin/bash | |
# settings | |
# Login information of freenom.com | |
freenom_email="main@address" | |
freenom_passwd="pswd" | |
# Open DNS management page in your browser. | |
# URL vs settings: | |
# https://my.freenom.com/clientarea.php?managedns={freenom_domain_name}&domainid={freenom_domain_id} | |
freenom_domain_name="domain.name" |
/** | |
* USB HID Keyboard scan codes as per USB spec 1.11 | |
* plus some additional codes | |
* | |
* Created by MightyPork, 2016 | |
* Public domain | |
* | |
* Adapted from: | |
* https://source.android.com/devices/input/keyboard-devices.html | |
*/ |
Searching can be an efficient way to navigate the current buffer.
The first search commands we learn are usually /
and ?
. These are seriously cool, especially with the incsearch
option enabled which lets us keep typing to refine our search pattern. /
and ?
really shine when all we want is to jump to something we already have our eyeballs on but they are not fit for every situation:
#!/usr/bin/env ruby | |
require 'openssl' | |
BLOCK_SIZE = 1024*1024 # 1M | |
CIPHER_BLOCK_SIZE = 128 | |
loop do | |
n = 0 | |
cipher = OpenSSL::Cipher::AES.new CIPHER_BLOCK_SIZE, :CBC | |
cipher.encrypt |