Skip to content

Instantly share code, notes, and snippets.

View ccnokes's full-sized avatar

Cameron Nokes ccnokes

View GitHub Profile
@chill117
chill117 / mysql_backup.sh
Last active December 13, 2021 22:02
Bash script to perform backups on one or more MySQL databases.
#!/bin/bash
#
# Use this script to perform backups of one or more MySQL databases.
#
# Databases that you wish to be backed up by this script. You can have any number of databases specified; encapsilate each database name in single quotes and separate each database name by a space.
#
# Example:
# databases=( '__DATABASE_1__' '__DATABASE_2__' )
@badsyntax
badsyntax / bash_callback.sh
Created July 26, 2013 13:42
A basic example showing the concept of callback functions in bash.
migrate_module() {
echo -e "\nRunning migration for module $1"
protected/yiic migrate --migrationPath=application.modules.$1.migrations
}
loop_modules() {
for file in `ls $MODULE_PATH`; do
if [ -d "$MODULE_PATH/$file" ] && [[ $file =~ ^$MODULE_REGEX ]]; then
$1 "$file"
@8bitDesigner
8bitDesigner / 1.md
Last active February 1, 2024 06:42
Git post-merge hook which, when you run `git merge` or `git pull` will then `bundle` if the project's Gemfile changed, or `npm install` if the project's package.json changed.Inspired and based off of https://gist.github.com/bumi/5706550

Make bundleing and npm installing easy

This repo has some handy handy hooks to run bundle or npm install whenever you:

  • git checkout a new branch with a different Gemfile or package.json
  • git pull a change to Gemfile or package.json

How can I has this!!?

  1. git clone https://gist.github.com/5869846.git hooks && cd hooks && chmod +x install
@samuelclay
samuelclay / radix_trie.js
Created January 30, 2013 16:55
A Radix Trie (aka PATRICIA trie) implemented in JavaScript. Play with it at this interactive JS fiddle: http://jsfiddle.net/jCYAw/
var RadixTrie = function(words) {
this.T = {};
this.initialize(words);
};
RadixTrie.prototype = {
initialize: function(words) {
var self = this;
words = words || [];
@jboner
jboner / latency.txt
Last active May 23, 2024 06:51
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@mathiasbynens
mathiasbynens / appify
Created November 12, 2010 13:46 — forked from subtleGradient/appify
appify — create the simplest possible Mac app from a shell script
#!/bin/bash
if [ "$1" = "-h" -o "$1" = "--help" -o -z "$1" ]; then cat <<EOF
appify v3.0.1 for Mac OS X - http://mths.be/appify
Creates the simplest possible Mac app from a shell script.
Appify takes a shell script as its first argument:
`basename "$0"` my-script.sh
@jzawodn
jzawodn / wait.sh
Created November 21, 2008 15:13
how to wait on multiple background processes and check exit status in bash
#!/bin/bash
FAIL=0
echo "starting"
./sleeper 2 0 &
./sleeper 2 1 &
./sleeper 3 0 &
./sleeper 2 0 &