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 | |
cur=`pwd` | |
inotifywait -mqr --timefmt '%d/%m/%y %H:%M' --format '%T %w %f' \ | |
-e modify ./ | while read date time dir file; do | |
ext="${file##*.}" | |
if [[ "$ext" = "go" ]]; then | |
echo "$file changed @ $time $date, rebuilding..." | |
go build |
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 | |
# I had a script which I wanted to have a special option that short-circuited the normal | |
# argument parsing error handling behavior so that it could be run without thenormal | |
# required arguments. This option would work similar to how `--help` or `--version` | |
# works, except that the parser would return a valid args object in its presence | |
# rather than exiting the program. | |
import argparse |
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
package main | |
import ( | |
"bytes" | |
"compress/gzip" | |
"database/sql/driver" | |
"errors" | |
"fmt" | |
"github.com/jmoiron/sqlx" | |
_ "github.com/mattn/go-sqlite3" |
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
package main | |
import ( | |
"fmt" | |
"io" | |
"net/http" | |
"os" | |
) | |
func init() { |
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 | |
# -*- coding: utf-8 -*- | |
"""Simple async crawler/callback queue based on gevent.""" | |
import traceback | |
import logging | |
import httplib2 | |
import gevent |
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 | |
# -*- coding: utf-8 -*- | |
""" """ | |
import json | |
from urllib2 import urlopen | |
from lxml.html import document_fromstring | |
from lxml.cssselect import CSSSelector as cs |
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
#include <stdbool.h> | |
#include <stdio.h> | |
#include <fcntl.h> | |
#include <sys/stat.h> | |
#include <sys/mman.h> | |
void print_region(char *ptr, size_t len); | |
// mark a few locations in a pointer | |
void mark(char *ptr, size_t len) { |
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
>>> humanize.naturalsize(1<<30) | |
'1.1 GB' | |
>>> humanize.naturalsize(1<<30, binary=True) | |
'1.0 GiB' | |
humanize.naturalsize(1<<30, gnu=True) | |
'1.0G' |
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 | |
LOADING=false | |
usage() | |
{ | |
cat << EOF | |
usage: $0 [options] dbname | |
OPTIONS: |
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
~$ chef-shell -wat | |
/opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/mixlib-cli-1.7.0/lib/mixlib/cli.rb:230:in `parse_options': invalid option: -wat (OptionParser::InvalidOption) | |
from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/shell.rb:288:in `parse_opts' | |
from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/shell.rb:178:in `parse_opts' | |
from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/lib/chef/shell.rb:56:in `start' | |
from /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-12.19.36/bin/chef-shell:34:in `<top (required)>' | |
from /usr/bin/chef-shell:57:in `load' | |
from /usr/bin/chef-shell:57:in `<main>' |
NewerOlder