Skip to content

Instantly share code, notes, and snippets.

View cicorias's full-sized avatar

Shawn Cicoria cicorias

View GitHub Profile
@cicorias
cicorias / tmux.md
Created March 20, 2017 19:11 — forked from andreyvit/tmux.md
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@cicorias
cicorias / installdocker.sh
Last active March 20, 2017 19:59
another docker install on ubuntu 14.04 LTS
#!/usr/bin/env bash
# from https://www.liquidweb.com/kb/how-to-install-docker-on-ubuntu-14-04-lts/
sudo apt-get update
sudo apt-get -y install docker.io
sudo ln -sf /usr/bin/docker.io /usr/local/bin/docker
sudo sed -i '$acomplete -F _docker docker' /etc/bash_completion.d/docker
sudo update-rc.d docker defaults
sudo gpasswd -a ${USER} docker
sudo service docker restart
#!/bin/bash
# remove exited containers:
docker ps --filter status=dead --filter status=exited -aq | xargs -r docker rm -v
# remove unused images:
docker images --no-trunc | grep '<none>' | awk '{ print $3 }' | xargs -r docker rmi
# remove unused volumes:
find '/var/lib/docker/volumes/' -mindepth 1 -maxdepth 1 -type d | grep -vFf <(
@cicorias
cicorias / getgeth.sh
Created March 22, 2017 16:36
geth via pps
sudo apt-get install software-properties-common
sudo add-apt-repository -y ppa:ethereum/ethereum
sudo apt-get update
sudo apt-get install ethereum
@cicorias
cicorias / Dockerfile
Created March 27, 2017 19:04 — forked from christianberg/Dockerfile
Sharing a unix socket between a Docker container and it's host
FROM ubuntu
RUN apt-get update
RUN apt-get install -y socat
VOLUME /foo
CMD socat UNIX-LISTEN:/foo/bar.sock -
@cicorias
cicorias / killGeth.sh
Last active March 30, 2017 15:58
Starting geth on the Test Net...
ps -a |grep geth | cut -d ' ' -f1 | xargs kill
@cicorias
cicorias / alternate.sh
Last active March 30, 2017 15:40 — forked from madis/gist:4650014
Testing CORS OPTIONS request with curl
curl -H "Origin: http://example.com" \
-H "Access-Control-Request-Method: POST" \
-H "Access-Control-Request-Headers: X-Requested-With" \
-X OPTIONS --verbose \
http://localhost:8545
@cicorias
cicorias / Object Flatten
Created March 30, 2017 21:56 — forked from penguinboy/Object Flatten
Flatten javascript objects into a single-depth object
var flattenObject = function(ob) {
var toReturn = {};
for (var i in ob) {
if (!ob.hasOwnProperty(i)) continue;
if ((typeof ob[i]) == 'object') {
var flatObject = flattenObject(ob[i]);
for (var x in flatObject) {
if (!flatObject.hasOwnProperty(x)) continue;
@cicorias
cicorias / index.js
Created March 30, 2017 21:58
flatten javascript objects
JSON.unflatten = function(data) {
"use strict";
if (Object(data) !== data || Array.isArray(data))
return data;
var result = {}, cur, prop, parts, idx;
for(var p in data) {
cur = result, prop = "";
parts = p.split(".");
for(var i=0; i<parts.length; i++) {
idx = !isNaN(parseInt(parts[i]));
@cicorias
cicorias / startssh.sh
Created April 9, 2017 17:27
ssh stuff
#!/usr/bin/env bash
eval "$(ssh-agent -s)"
# ssh-add ~/.ssh/id_rsa