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
var $TitleAlert = (function(document, window, undefined) { | |
var options = { | |
count: 2, // by default flash 2 times | |
period: 1200, // default period 1200ms | |
flashTitle: " --- ** --- " | |
} | |
// private | |
var origTitle = document.title; | |
var intervalID = undefined; |
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
%%% This is a clever Erlang macro that given a record name will create a new function | |
%%% that converts from a property list to the record (which really is a taged tuple). | |
-define(proplist_to_record(Record), | |
fun(Proplist) -> | |
Fields = record_info(fields, Record), | |
[Tag| Values] = tuple_to_list(#Record{}), | |
Defaults = lists:zip(Fields, Values), | |
L = lists:map(fun ({K,V}) -> proplists:get_value(K, Proplist, V) end, Defaults), | |
list_to_tuple([Tag|L]) |
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 python2 | |
import json | |
import requests | |
def count_user_commits(user): | |
r = requests.get('https://api.github.com/users/%s/repos' % user) | |
repos = json.loads(r.content) | |
for repo in repos: |
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
/* | |
see http://wiki.apache.org/couchdb/Document_Update_Handlers | |
in a couchapp this would be updates/new.js or something | |
you then setup githubs POST hook to this update function, something like: | |
http://hostname.example.net/database/_design/github/_update/new | |
see http://help.github.com/post-receive-hooks/ | |
*/ | |
function (_doc, req) { | |
if (req.method !== 'POST') { |
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
%%% This macro will create a function that converts a record to | |
%%% a {key, value} list (a proplist) | |
-define(record_to_list(Record), | |
fun(Val) -> | |
Fields = record_info(fields, Record), | |
[_Tag| Values] = tuple_to_list(Val), | |
lists:zip(Fields, Values) | |
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
#!/bin/sh | |
mkdir /home/tftproot | |
# install syslinux from package and symlink it or just download and extract it | |
ln -s /usr/lib/syslinux /home/tftproot/syslinux | |
mkdir /home/tftproot/pxelinux.cfg/ | |
cat > /home/tftproot/pxelinux.cfg/default <<EOF |
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
function xhr_watchdog(httpRequest, interval) { | |
const max_tries = 2 | |
function _watchdog(last_length, n) { | |
if (httpRequest.readyState <= 3) { | |
var new_length = httpRequest.responseText.length | |
if (new_length > last_length) { | |
document.body.innerHTML +="Connection alive<br>\n" | |
window.setTimeout(_watchdog, interval, new_length, max_tries) | |
} else if (n > 0) { | |
n = n - 1; |
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
# | |
# Automatically generated file; DO NOT EDIT. | |
# Linux/x86 3.10.0 Kernel Configuration | |
# | |
# CONFIG_64BIT is not set | |
CONFIG_X86_32=y | |
CONFIG_X86=y | |
CONFIG_INSTRUCTION_DECODER=y | |
CONFIG_OUTPUT_FORMAT="elf32-i386" | |
CONFIG_ARCH_DEFCONFIG="arch/x86/configs/i386_defconfig" |
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
<html> | |
<!-- WILL NOT WORK with the HTML5 doctype --> | |
<div class="text-stretch"> | |
<input /> | |
</div> | |
</html> |
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
# file: /etc/ppp/peers/3g | |
# usage: pppd call 3g | |
connect '/etc/ppp/peers/dial -V -Upublicinternet -T*99***1#' | |
user internet | |
password internet | |
noauth | |
usepeerdns |