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 | |
TMUX_ROOT=~/tmux | |
# Install tmux in a barebones Ubuntu environment without root (like a Docker | |
# container for Ethos) | |
apt-get download tmux libutempter0 libevent-core-2.1-7 ncurses-base | |
for deb in *.deb; do | |
dpkg -x ${deb} ${TMUX_ROOT} |
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
@contextlib.contextmanager | |
def multiple_targets(mock_patches): | |
""" | |
`mock_patches` is a list (or iterable) of mock.patch objects | |
Example usage: | |
with mock.patch.multiple_targets([ | |
mock.patch('os.path.exists', side_effect=mock_path_exists), | |
mock.patch('subprocess.Popen'), |
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 dataclasses import dataclass | |
from typing import Optional | |
@dataclass | |
class FakeSocket: | |
chunks: list[bytes] = None | |
buf: bytes = None | |
max_chunk_size: Optional[int] = None | |
log_func: Optional[callable] = None |
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 | |
# change the values below to match your system. | |
# target the BUILD_DIR to output from an nw.io build process. nwjs-shell-builder recommended! | |
# https://github.com/Gisto/nwjs-shell-builder | |
# BASE_DIR is the target directory for this script, where files will be gathered and packaged to | |
BUILD_DIR="/var/www/deploy/TMP/osx-ia32/latest-git" | |
BASE_DIR="/var/www/deploy/osx" |
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 git_prompt_info() { | |
ref=$(git symbolic-ref HEAD 2> /dev/null) || return | |
echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$ZSH_THEME_GIT_PROMPT_SUFFIX" | |
} |
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 | |
from sys import argv | |
from hashlib import sha1 | |
from cStringIO import StringIO | |
class githash(object): | |
def __init__(self): | |
self.buf = StringIO() |
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 datetime | |
import gevent | |
import gevent.socket | |
import os | |
import pymssql | |
#import random | |
server = os.getenv("PYMSSQL_TEST_SERVER") | |
user = os.getenv("PYMSSQL_TEST_USERNAME") | |
password = os.getenv("PYMSSQL_TEST_PASSWORD") |
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
@contextlib.contextmanager | |
def multiple_mocks(mock_specs): | |
""" | |
`mock_specs` is a dict of mock target name => mock patch kwargs | |
Example usage: | |
with multiple_mocks( | |
{'os.path.exists': {'side_effect': mock_path_exists}, | |
'subprocess.Popen': {}, |
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
[buildout] | |
parts = pcre varnish-build varnish supervisor | |
origin_port = 8080 | |
varnish_port = 8000 | |
supervisor_port = 9002 | |
[pcre] | |
recipe = hexagonit.recipe.cmmi | |
url = http://downloads.sourceforge.net/project/pcre/pcre/8.12/pcre-8.12.tar.gz |
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
on alfred_script(q) | |
set theYear to year of (current date) as string | |
set theMonth to (month of (current date) as number) | |
if theMonth < 10 then | |
set theMonth to "0" & theMonth | |
else | |
set theMonth to "" & theMonth | |
end if |
NewerOlder