Skip to content

Instantly share code, notes, and snippets.

View spankie's full-sized avatar
🤓
Writing Code...

Odohi David spankie

🤓
Writing Code...
View GitHub Profile
@matthewmccullough
matthewmccullough / .zshrc
Created January 20, 2011 00:00
A configuration to maintain history across sessions and share it across terminals in ZShell
##############################################################################
# History Configuration
##############################################################################
HISTSIZE=5000 #How many lines of history to keep in memory
HISTFILE=~/.zsh_history #Where to save history to disk
SAVEHIST=5000 #Number of history entries to save to disk
#HISTDUP=erase #Erase duplicates in the history file
setopt appendhistory #Append history to the history file (no overwriting)
setopt sharehistory #Share history across terminals
setopt incappendhistory #Immediately append to the history file, not just when a term is killed
@branneman
branneman / better-nodejs-require-paths.md
Last active July 30, 2024 01:03
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@jiggzson
jiggzson / scientificToDecimal.js
Last active December 25, 2022 21:03
Converts a javascript number from scientific notation to a decimal string
var scientificToDecimal = function (num) {
var nsign = Math.sign(num);
//remove the sign
num = Math.abs(num);
//if the number is in scientific notation remove it
if (/\d+\.?\d*e[\+\-]*\d+/i.test(num)) {
var zero = '0',
parts = String(num).toLowerCase().split('e'), //split into coeff and exponent
e = parts.pop(), //store the exponential part
l = Math.abs(e), //get the number of zeros
@sdorra
sdorra / keys.go
Created April 17, 2016 19:31
Golang RSA Key Generation
/*
* Genarate rsa keys.
*/
package main
import (
"crypto/rand"
"crypto/rsa"
"crypto/x509"
@russkociuba
russkociuba / iterm2_script_tabs.scpt
Created November 28, 2016 21:12
Opens a new iTerm2 window with multiple tabs each executing a command set in the script
# The list of commands to run in each tab of the terminal window
set cmdList to {"ssh user@host1.example.com", "ssh user@host2.example.com"}
# You can append to the list just to break up really long lines
# set cmdList to cmdList & {"ssh user@host3.example.com"}
tell application "iTerm2"
# Not sure how to create an "empty" window so for the window we pick the
# first command in the list