Skip to content

Instantly share code, notes, and snippets.

View anoxic's full-sized avatar
🐙
working on it all at once

Bad Sir Brian anoxic

🐙
working on it all at once
View GitHub Profile
@anoxic
anoxic / git-completion.bash
Last active July 1, 2018 22:39 — forked from qbit/gist:5483415
KSH support for git-prompt
# bash/zsh completion support for core Git.
#
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
# Distributed under the GNU General Public License, version 2.0.
#
# The contained completion routines provide support for completing:
#
# *) local and remote branch names
# *) local and remote tag names
@anoxic
anoxic / git_branch_naming.md
Last active May 22, 2018 15:54 — forked from revett/git_branch_naming.md
Git Branch Naming Conventions

<type>-<name>

<type>

bug    - Code changes linked to a known issue.
clean  - Cleans up whitespace, organization, re/de-factoring.
dev    - Experiments (will not be merged without a rename). Doesn't need a status.
feat   - New feature.
hotfix - Quick fixes to the codebase.
perf - Performace enhancements.
@anoxic
anoxic / expecting.md
Created November 20, 2016 08:52 — forked from ksafranski/expecting.md
Basic principles of using tcl-expect scripts

Intro

TCL-Expect scripts are an amazingly easy way to script out laborious tasks in the shell when you need to be interactive with the console. Think of them as a "macro" or way to programmaticly step through a process you would run by hand. They are similar to shell scripts but utilize the .tcl extension and a different #! call.

Setup Your Script

The first step, similar to writing a bash script, is to tell the script what it's executing under. For expect we use the following:

#!/usr/bin/expect

Linux/UN*X Command Line

Start with LinuxCommand.org.

A good cheatsheet will go a long way. Google is your friend. One great option is "Linux Gems", try going through and learning about each one.

If you know DOS at all, Linux for DOS users might help. (It also works in reverse if you know Linux and you're trying to survive on Windows.)

When you don't know what a command means, a nifty little utility called Explain Shell can help, and from there you can read the man or info pages to glean more.

<?php
function luhn2($number) {
static $sum_table = [[0,1,2,3,4,5,6,7,8,9],[0,2,4,6,8,1,3,5,7,9]];
$sum = 0;
$number = (string)$number;
$i = strlen($number);
while (--$i) {
$sum += $sum_table[($i+1) % 2][$number[$i]];
current db: db
list dbs: show dbs
change db: use DB_NAME
insert: db.COLLECTION_NAME.insert( j )
collections: show collections
<style>
* {
margin: 0;
border-radius: 2px;
}
body {
margin: 3%;
background: #eee;
}
column {
process.stdout.write() // Write to console
# Types
@anoxic
anoxic / erlang
Last active August 29, 2015 14:02
123 - Numbers
1.2 - Float
2#110 - Binary 6
{,} - Tuples
[,] - Lists (also "strings")
"ab" - A shortcut for [97,98]
atom - An atom
'atom'
Var = 1. - Setting a variable (constant).