Skip to content

Instantly share code, notes, and snippets.

View simeg's full-sized avatar
:octocat:
I may be slow to respond.

Simon Egersand simeg

:octocat:
I may be slow to respond.
View GitHub Profile
@simeg
simeg / gist:c0ed34b12350bc69a61222bc2fdb65b6
Created September 22, 2017 06:52 — forked from bhurlow/gist:3043629
Linux Screen Cheat Sheets
–ctrl a c -> cre­ate new win­dow
–ctrl a A -> set win­dow name
–ctrl a w -> show all win­dow
–ctrl a 1|2|3|… -> switch to win­dow n
–ctrl a ” -> choose win­dow
–ctrl a ctrl a -> switch between win­dow
–ctrl a d -> detach win­dow
–ctrl a ? -> help
–ctrl a [ -> start copy, move cur­sor to the copy loca­tion, press ENTER, select the chars, press ENTER to copy the selected char­ac­ters to the buffer
–ctrl a ] -> paste from buffer
@simeg
simeg / delete-unttagged-images.md
Created September 17, 2017 18:33
Delete all unttagged Docker images

$ docker rmi $(docker images -a | grep "^" | awk '{print $3}')

@simeg
simeg / Dockerfile
Created September 17, 2017 18:30
Dockerfiles for Python 2 & 3 with uWSGI
# Taken from post in https://github.com/gliderlabs/docker-alpine/issues/158
FROM gliderlabs/alpine:latest
# install system packages
RUN apk add --update --no-cache \
python \
python-dev \
build-base \
linux-headers \
pcre-dev \
@simeg
simeg / API.md
Created September 9, 2017 15:05 — forked from iros/API.md
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

@simeg
simeg / npm-package-canvas-fix.md
Last active August 17, 2022 13:40
How to install canvas package

For OS X 10.12

If you get this error when installing the npm package canvas

$ npm install canvas

npm WARN gentlyRm not removing /Users/simon/repos/mac-setup/node_modules/.bin/rimraf as it wasn't installed by /Users/simon/repos/mac-setup/node_modules/rimraf

> canvas@1.6.6 install /Users/simon/repos/mac-setup/node_modules/canvas
> node-gyp rebuild
@simeg
simeg / bash-is-executable-available.sh
Created August 26, 2017 16:10
Bash function to see if executable is on $PATH
#!/bin/bash -e
# Example executables
readonly commands=(python git gitbook cp)
function is_available {
command -v $1 >/dev/null 2>&1 || { echo >&2 "I require $1 but it's not installed. Aborting."; exit 1; }
}
# Example usage (single)
@simeg
simeg / headless-rpi-setup.md
Last active August 25, 2017 15:45
Headless Raspberry Pi Setup

Prerequisites

  1. Raspberry Pi
  2. SD card
  3. Electric and network cable to RPi

Setup

  1. Download a distro image
  2. Connect SD card to computer
  3. List all available disks
@simeg
simeg / solver.js
Created May 14, 2017 16:44 — forked from hughrawlinson/solver.js
Naive 2048 Solver
var a = (keyCode)=>{
var keyEvent = document.createEvent("Events");
keyEvent.initEvent("keydown", true, true);
keyEvent.keyCode = keyCode;
keyEvent.which = keyCode;
document.body.dispatchEvent(keyEvent);
}
const LEFT = 37;
const UP = 38;