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 Semaphore = function(callback, context) { | |
this.semaphore = 0; | |
this.callback = callback; | |
this.context = context || this; | |
}; | |
Semaphore.prototype.increment = function(i) | |
{ | |
if (i == undefined) { | |
i = 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
#!/bin/bash | |
# | |
# Improved version of http://docs.dotcloud.com/guides/backups/ | |
# | |
HOSTNAME=`hostname` | |
TAG="${HOSTNAME}_$(TZ=UTC date +%Y-%m-%d_%H:%M:%S_UTC)" | |
[ "$3" ] || { | |
echo "Please specify what to backup, how, and where." |
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
case $ARCH in | |
amd64|i386) | |
default_mirror http://archive.ubuntu.com/ubuntu | |
;; | |
sparc) | |
case $SUITE in | |
gutsy) | |
default_mirror http://archive.ubuntu.com/ubuntu | |
;; | |
*) |
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 __rvm_prompt { | |
rvm-prompt ' ' i v g | |
} | |
function __color_prompt { | |
local G='\[\033[01;32m\]' | |
local B='\[\033[01;34m\]' | |
local W='\[\033[00m\]' | |
local R='\[\033[01;31m\]' | |
local Y='\[\033[01;33m\]' |
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 -*- | |
# | |
# Dump all replication events from a remote mysql server | |
# | |
from pymysqlreplication import BinLogStreamReader | |
import gc |
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
# inspired by http://ariejan.net/2010/08/23/resque-how-to-requeue-failed-jobs | |
# retry all failed Resque jobs except the ones that have already been retried | |
# This is, for instance, useful if you have already retried some jobs via the web interface. | |
Resque::Failure.count.times do |i| | |
Resque::Failure.requeue(i) unless Resque::Failure.all(i, 1)['retried_at'].present? | |
end | |
# retry all :) | |
Resque::Failure.count.times do |i| |
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
#Use current directory as default search scope in Finder | |
defaults write com.apple.finder FXDefaultSearchScope -string "SCcf" | |
#Show Path bar in Finder | |
defaults write com.apple.finder ShowPathbar -bool true | |
#Show Status bar in Finder | |
defaults write com.apple.finder ShowStatusBar -bool true | |
#Enable AirDrop over Ethernet and on unsupported Macs running Lion |
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 | |
echo "Pre-commit started" | |
echo "PEP 8" | |
git diff --cached --name-only | grep .py | grep -v old_ | xargs autopep8 --in-place -v --aggressive --aggressive | |
git diff --cached --name-only | grep .py | grep -v old_ | xargs git add | |
git diff --cached --name-only | grep .py | grep -v old_ | xargs pep8 | |
if [ $? == 0 ] |
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
import os | |
import sys | |
import re | |
import inspect | |
from PyQt5 import QtWidgets | |
class FilePatcher: | |
def __init__(self, path): | |
self._path = path | |
self._line_number = 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
from PyQt5 import QtCore,QtNetwork | |
import sys | |
app = QtCore.QCoreApplication(sys.argv) | |
f = QtCore.QFile("test.image") | |
url = QtCore.QUrl("http://localhost:8001/v1/dynamips/vms/test.image") |
OlderNewer