Skip to content

Instantly share code, notes, and snippets.

@ender672
ender672 / mitm_omniture.py
Created November 21, 2014 22:23
mitmproxy script for showing omniture events, evars, and props
$ mitmdump -q -s mitm_omniture.py
@andriisoldatenko
andriisoldatenko / install_python.sh
Last active May 14, 2020 05:43
Install local Python 2.7.10 on CentOS 7
TMP_PATH=~/tmp_install_python
# Versions section
PYTHON_MAJOR=2.7
PYTHON_VERSION=$PYTHON_MAJOR.10
mkdir $TMP_PATH && cd $TMP_PATH
# Update yum and libraries
yum -y update
@a1phanumeric
a1phanumeric / gist:5346170
Created April 9, 2013 14:35
Grep exclusions. Demonstrates how to exclude multiple directories, and files.
grep -r --color --exclude-dir={custom,lib,scripts} --exclude={*.xml,error_log} "beta" .
@tamlyn
tamlyn / README.md
Last active July 7, 2022 09:48
Execution order of Jest/Jasmine test code

Execution order of Jest/Jasmine test code

While tests run in source order, surrounding code does not which can lead to hard to debug issues.

Compare the test file below with the sample output below that and note the order of the log messages.

Key points

  • Any code not inside of it, beforeAll, afterAll, beforeEach or afterEach runs immediately on initialisation.
  • This means code at the end of your file runs before even your before hooks.
@traviskaufman
traviskaufman / jasmine-this-vars.md
Last active September 19, 2022 14:35
Better Jasmine Tests With `this`

Better Jasmine Tests With this

On the Refinery29 Mobile Web Team, codenamed "Bicycle", all of our unit tests are written using Jasmine, an awesome BDD library written by Pivotal Labs. We recently switched how we set up data for tests from declaring and assigning to closures, to assigning properties to each test case's this object, and we've seen some awesome benefits from doing such.

The old way

Up until recently, a typical unit test for us looked something like this:

describe('views.Card', function() {
@fljot
fljot / Mac OS X 10_5_ Windows Ctrl.xml
Last active January 9, 2023 07:12
AutoHotkey mappings to emulate OSX keyboard shortcuts on Windows
<!-- put this to IDEA keymaps config folder. For v13 it is <userdir>\.IntelliJIdea13\config\keymaps\ -->
<?xml version="1.0" encoding="UTF-8"?>
<keymap version="1" name="Mac OS X 10.5+ Windows Ctrl" parent="Mac OS X 10.5+">
<action id="$Copy">
<keyboard-shortcut first-keystroke="meta C" />
<keyboard-shortcut first-keystroke="meta INSERT" />
<keyboard-shortcut first-keystroke="control C" />
<keyboard-shortcut first-keystroke="control INSERT" />
</action>
<action id="$Cut">
@necolas
necolas / rsync_backup
Created August 14, 2011 23:27
Maintain a bootable clone of Mac OS X volume
#!/bin/sh
PROG=$0
RSYNC="/usr/bin/rsync"
SRC="/"
DST="/Volumes/Backup/"
# rsync options
# -v increase verbosity
# -a turns on archive mode (recursive copy + retain attributes)
@jessicald
jessicald / gist:2861038
Created June 3, 2012 02:34
Class vs. Dictionary; or, An Example of Space-Time Tradeoff

Class vs. Dictionary; or, An Example of Space–Time Tradeoff in Python

Conclusions; or, tl;dr

What wins?

  • struct-like objects, i.e. ones that are largely the same as a C struct instance, win in the memory department.
    • These tests do not try to determine what is best for very large sets of values, however; I direct the reader to http://stackoverflow.com/a/2670191 for an insight into that scenario when using a dictionary.
  • Dictionaries beat out objects in access times.
  • According to Wikipedia, the Python dictionary is highly optimised because it is used internally to implement namespaces. [citation needed]
@andyvanee
andyvanee / .ssh_config
Last active November 30, 2023 04:19
Fix unix_listener too long for Unix domain socket
Host *
ControlPath ~/.ssh/control/%C
ControlMaster auto
@rxin
rxin / ramdisk.sh
Last active December 13, 2023 02:40
ramdisk create/delete on Mac OS X.
#!/bin/bash
# From http://tech.serbinn.net/2010/shell-script-to-create-ramdisk-on-mac-os-x/
#
ARGS=2
E_BADARGS=99
if [ $# -ne $ARGS ] # correct number of arguments to the script;
then