Skip to content

Instantly share code, notes, and snippets.

@socketwiz
socketwiz / data-work-in-progress.js
Created May 13, 2017 22:21
Screeps refactor idea
const DATA = {
'rooms': [
{
'name': 'sim',
'spawn': {
'name': 'SpawnSim',
'position': {
'x': 7,
@socketwiz
socketwiz / Dockerfile
Created February 28, 2017 12:03
Java v9, maven and tomcat
#
# Oracle Java 9 Dockerfile
#
# https://github.com/cogniteev/docker-oracle-java
# https://github.com/cogniteev/docker-oracle-java/tree/master/oracle-java9
#
# Pull base image.
FROM ubuntu:16.04
@socketwiz
socketwiz / promise.js
Last active January 15, 2016 15:13
ajax promises
var $promise = $.ajax(options);
$promise
.then(function(data){
// data will be from the ajax call
return data;
})
.then(function(data){
// data will be the data you return from the previous call
return 'foo';
@socketwiz
socketwiz / cloud-config.yml
Last active April 6, 2018 06:51
CoreOS cloud-config for DigitalOcean with iptables firewall
#cloud-config
coreos:
etcd2:
# generate a new token for each unique cluster from https://discovery.etcd.io/new?size=3
# specify the initial size of your cluster with ?size=X
discovery: https://discovery.etcd.io/<token>
# multi-region and multi-cloud deployments need to use $public_ipv4
advertise-client-urls: http://$private_ipv4:2379,http://$private_ipv4:4001
initial-advertise-peer-urls: http://$private_ipv4:2380
@socketwiz
socketwiz / standard.json
Created October 20, 2013 19:35
Template for creating SmartOS zones.
{
"brand": "joyent",
"zfs_io_priority": 30,
"quota": 20,
"image_uuid": "dac2ad6e-2aa5-11e3-885f-8fd408fc6a82",
"max_physical_memory": 4096,
"alias": "<name>",
"hostname": "<name>",
"dns_domain": "<domain>",
"resolvers": ["<ip>"],
@socketwiz
socketwiz / smartos.md
Last active September 30, 2017 19:24
SmartOS cheat sheet

Create a dvd or flash drive: http://wiki.smartos.org/display/DOC/Download+SmartOS

Boot the image on the hardware of your choice

It will ask you the following:

  1. ip or dhcp
  2. it will enumerate the disks it finds and ask you to type in the ones you want SmartOS to manage, type in the ones you want
  3. root password
#
# RoverExecutor.py
# Rover
#
# Created by Ricky Nelson on 7/16/10.
#
from Foundation import *
from AppKit import *
import subprocess
@socketwiz
socketwiz / tmux.md
Created May 21, 2012 16:02
TMUX cheat sheet

named session
tmux new -s <name>
add -d to run in the background

command PREFIX
ctrl-b

detach
PREFIX d

@socketwiz
socketwiz / vim.markdown
Last active October 13, 2021 14:15
Vim cheat sheet

motions

motion description
h Count characters left
l Count characters right
^ To the first character of the line
$ To the last character of the line
f<char> To the counth character occurrence to the right. F<char> to the counth character occurrence to the left
t<char> To 1 character just before the counth character occurrence to the right