Skip to content

Instantly share code, notes, and snippets.

View beaufour's full-sized avatar

Allan Beaufour beaufour

View GitHub Profile
@lukaszkorecki
lukaszkorecki / put_big_charbeat_number.html
Created July 27, 2010 14:24
Chartbeat user count in your browser as one, big, fat number
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Chartbeat Status</title>
<script src="http://ajax.googleapis.com/ajax/libs/prototype/1.6.1.0/prototype.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
SOUND_PLAYED_YEAH = false;
NUMBER_OF_PEOPLE = 0;
import pylibmc
import Queue
import logging
import functools
"""
This is a transparent pool library that wraps a pylibmc client
from MemcachePool import mc
mc.get(key)
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@daniyalzade
daniyalzade / check_cluster.py
Created November 13, 2012 17:39
Nagios Plugin For Checking Uptime in a Cluster (over multiple hosts)
#!/usr/bin/env python
# Script to enure that the cluster defined by the hostgroup, or list
# hosts has enough healthy nodes as defined by the 'check_ping' plugin.
# If it has more than N number of unhealthy nodes, the plugin returns
# the appropriate error.
#
# To get the list of hosts from a hostgroup, this script parses nagios'
# hosts.cfg file which has the following format:
#
# coding=UTF-8
from __future__ import division
import re
# This is a naive text summarization algorithm
# Created by Shlomi Babluki
# April, 2013
class SummaryTool(object):
@jedi4ever
jedi4ever / dns tuning ssh login speedup vagrant
Created May 27, 2013 13:37
speeding up DNS/SSH connections in vagrant
- Tune /etc/ssh/sshd_config
UseDNS no # Disable DNS lookups
GSSAPIAuthentication no # Disable negotation of slow GSSAPI
don't forget to restart it, use a script provider to set it , or create it with veewee or snapshot it
- Tune Vagrantfile
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
@mplewis
mplewis / google_latitude_api_access.py
Created July 14, 2013 03:54
A script that downloads your Google Latitude data and saves it into separate JSON files. Check out my blog post on this: http://www.mplewis.com/octopress/blog/2013/07/13/downloading-your-google-location-history-with-the-google-api-python-client-library/
#!/usr/bin/python
import httplib2
import json
from apiclient.discovery import build
from oauth2client.file import Storage
from oauth2client.client import AccessTokenRefreshError
from oauth2client.client import OAuth2WebServerFlow
from oauth2client.tools import run
from datetime import datetime
@minrk
minrk / nbstripout
Last active June 6, 2023 06:23
git pre-commit hook for stripping output from IPython notebooks
#!/usr/bin/env python
"""strip outputs from an IPython Notebook
Opens a notebook, strips its output, and writes the outputless version to the original file.
Useful mainly as a git filter or pre-commit hook for users who don't want to track output in VCS.
This does mostly the same thing as the `Clear All Output` command in the notebook UI.
LICENSE: Public Domain
#!/bin/bash
# This script automatically sets the version and short version string of
# an Xcode project from the Git repository containing the project.
#
# To use this script in Xcode, add the script's path to a "Run Script" build
# phase for your application target.
set -o errexit
set -o nounset
@asmaloney
asmaloney / Packaging_Example.sh
Last active September 14, 2023 14:45
This is an example of script to package up and create a DMG for a Mac OS X app. Details may be found here: http://asmaloney.com/2013/07/howto/packaging-a-mac-os-x-application-using-a-dmg/
#!/bin/bash
# by Andy Maloney
# http://asmaloney.com/2013/07/howto/packaging-a-mac-os-x-application-using-a-dmg/
# make sure we are in the correct dir when we double-click a .command file
dir=${0%/*}
if [ -d "$dir" ]; then
cd "$dir"
fi