Skip to content

Instantly share code, notes, and snippets.

View dersam's full-sized avatar

Samuel Schmidt dersam

View GitHub Profile
# Weather
# =======
#
# By Jezen Thomas <[email protected]>
#
# This script sends a couple of requests over the network to retrieve
# approximate location data, and the current weather for that location. This is
# useful if for example you want to display the current weather in your tmux
# status bar.
@dersam
dersam / behatbox
Created September 23, 2016 14:25
Start a docker machine for running tests via Webdriver with the elgalu/selenium container
#!/usr/bin/env bash
docker-machine start default
docker rm -f grid
docker run --rm --name=grid --add-host='develop.vagrant.dev:192.168.80.80' -p 4444:24444 -p 5920:25900 \
-v /dev/shm:/dev/shm -e VNC_PASSWORD=hola elgalu/selenium:2.51.0b > /dev/null &
sleep 5
@dersam
dersam / benchmark_url
Last active September 23, 2016 14:12
Rudimentary response time tester
#!/usr/bin/php
<?php
if (!isset($argv[1])) {
die('No url provided.');
}
$cmd = "wget {$argv[1]} --no-check-certificate --delete-after -q --output-document=/dev/null";
$avg = 0;
$iterations = 10;
@dersam
dersam / gitkraken.zsh
Last active September 17, 2024 20:22
Open GitKraken using the current repo directory in the cli.
## Open GitKraken using the current repo directory.
## For when you want a prettier view of your current repo,
## but prefer staying in the cli for most things.
## This will break if GitKraken ever removes the -p flag.
## If you're not using OSX, the path is definitely different.
kraken () {
~/Applications/GitKraken.app/Contents/MacOS/GitKraken -p $(pwd)
}
@dersam
dersam / gpg-import-and-export-instructions.md
Created September 20, 2016 19:14 — forked from chrisroos/gpg-import-and-export-instructions.md
Instructions for exporting/importing (backup/restore) GPG keys

Every so often I have to restore my gpg keys and I'm never sure how best to do it. So, I've spent some time playing around with the various ways to export/import (backup/restore) keys.

Method 1

Backup the public and secret keyrings and trust database

cp ~/.gnupg/pubring.gpg /path/to/backups/
cp ~/.gnupg/secring.gpg /path/to/backups/
cp ~/.gnupg/trustdb.gpg /path/to/backups/

or, instead of backing up trustdb...

@dersam
dersam / states.php
Created August 5, 2016 18:16
US states as php array
$states = array('AL'=>"Alabama",
'AK'=>"Alaska",
'AZ'=>"Arizona",
'AR'=>"Arkansas",
'CA'=>"California",

Keybase proof

I hereby claim:

  • I am dersam on github.
  • I am dersam (https://keybase.io/dersam) on keybase.
  • I have a public key ASACkWQAVA5-wRu26qe6FlJl8smwXfnWIB8PfNKk9MqvDwo

To claim this, I am signing this object:

@dersam
dersam / index.php
Created February 1, 2016 15:19
[magento] multidomain-multistore-multistoreview setup with visible language codes

Use these snippets to setup a magento installation with the following structure:

@dersam
dersam / tmux.mouse.conf
Created October 30, 2015 15:53
tmux 2.1 Mouse Settings
#tmux 2.1 changes how it handles mouse events
#These settings should be all that is necessary to get scrolling and pane selection working again.
#From http://stackoverflow.com/questions/30185210/ubuntu-change-tmux-1-8-to-tmux-next-1-9
#iTerm doesn't require easysimbl
set -g mouse-utf8 on
set -g mouse on
bind -n WheelUpPane select-pane -t= \; copy-mode -e \; send-keys -M
bind -n WheelDownPane select-pane -t= \; send-keys -M
DROP TABLE IF EXISTS `countries`;
CREATE TABLE `countries` (
`id` int(11) NOT NULL auto_increment,
`country_code` varchar(2) NOT NULL default '',
`country_name` varchar(100) NOT NULL default '',
PRIMARY KEY (`id`)
);
INSERT INTO `countries` VALUES (1, 'US', 'United States');
INSERT INTO `countries` VALUES (2, 'CA', 'Canada');