Skip to content

Instantly share code, notes, and snippets.

@CreaturePhil
CreaturePhil / gitnotes.md
Last active August 29, 2015 14:09
Git notes

Git setup

$ git config --global user.name "John Doe"
$ git config --global user.email johndoe@example.com

Check your settings

Emacs cheatsheet

  • C-x C-c End emacs session
  • C-g Partially quit entered command

  • C-v Move forward one screenful
  • M-v Move backward one screenful
  • C-l Move the text around the cursor to the center of the screen. Also, it clears the screen and redisplay all the text
@jedwood
jedwood / sample-test-1.js
Last active July 4, 2016 23:55
API Testing Example - Part 1
describe('Authentication', function() {
it('errors if wrong basic auth', function(done) {
api.get('/blog')
.set('x-api-key', '123myapikey')
.auth('incorrect', 'credentials')
.expect(401, done)
});
it('errors if bad x-api-key header', function(done) {
@jaredgrady
jaredgrady / bin_search.py
Last active April 10, 2017 15:35
Binary search a list of ints. Recursive implementation in Python.
def bin_search(L, a):
if (len(L) == 1):
return "NO"
mid = len(L) // 2
if (a < L[mid]):
return bin_search(L[:mid], a)
elif (a > L[mid]):
return bin_search(L[mid:], a)
@ozziexsh
ozziexsh / _grid.scss
Last active September 8, 2017 11:45
SCSS Grid Component
$columns: 12;
$grid-breakpoints: (
xs: 0,
sm: 544px,
md: 768px,
lg: 992px,
xl: 1200px
);
@egonSchiele
egonSchiele / dining_with_waiter.rb
Created May 16, 2013 18:20
Dining philosophers using locks in Ruby. This implements a Waiter who is in charge of forks.
require 'thread'
class Waiter
def initialize
@mutex = Mutex.new
end
def can_eat? philosopher
left = philosopher.left_fork
right = philosopher.right_fork
@diegoconcha
diegoconcha / redux_egghead_notes.md
Last active January 18, 2022 13:23
Redux Egghead.io Notes

###Redux Egghead Video Notes###

####Introduction:#### Managing state in an application is critical, and is often done haphazardly. Redux provides a state container for JavaScript applications that will help your applications behave consistently.

Redux is an evolution of the ideas presented by Facebook's Flux, avoiding the complexity found in Flux by looking to how applications are built with the Elm language.

####1st principle of Redux:#### Everything that changes in your application including the data and ui options is contained in a single object called the state tree

@kyledrake
kyledrake / gist:d7457a46a03d7408da31
Last active October 22, 2023 12:25
Creating a self-signed SSL certificate, and then verifying it on another Linux machine
# Procedure is for Ubuntu 14.04 LTS.
# Using these guides:
# http://datacenteroverlords.com/2012/03/01/creating-your-own-ssl-certificate-authority/
# https://turboflash.wordpress.com/2009/06/23/curl-adding-installing-trusting-new-self-signed-certificate/
# https://jamielinux.com/articles/2013/08/act-as-your-own-certificate-authority/
# Generate the root (GIVE IT A PASSWORD IF YOU'RE NOT AUTOMATING SIGNING!):
openssl genrsa -aes256 -out ca.key 2048
openssl req -new -x509 -days 7300 -key ca.key -sha256 -extensions v3_ca -out ca.crt
@MicahElliott
MicahElliott / colortrans.py
Created November 29, 2010 07:57
Convert values between RGB hex codes and xterm-256 color codes.
#! /usr/bin/env python
""" Convert values between RGB hex codes and xterm-256 color codes.
Nice long listing of all 256 colors and their codes. Useful for
developing console color themes, or even script output schemes.
Resources:
* http://en.wikipedia.org/wiki/8-bit_color
* http://en.wikipedia.org/wiki/ANSI_escape_code
/*
A Minimal Capture Program
This program opens an audio interface for capture, configures it for
stereo, 16 bit, 44.1kHz, interleaved conventional read/write
access. Then its reads a chunk of random data from it, and exits. It
isn't meant to be a real program.
From on Paul David's tutorial : http://equalarea.com/paul/alsa-audio.html