Skip to content

Instantly share code, notes, and snippets.

var http = require("http")
// messages should be relatively short.
var maxLength = 1024
var server = http.createServer(function (req, res) {
// requests come in as json
// need to parse the json to get from, to, and body fields.
// JSON is probably generated by some native C JSON encoder
// on a device, or in some other language, or perhaps from
@zollinger
zollinger / getcolor.py
Last active November 6, 2024 08:18
Simple way to get dominant colors from an image in Python
from PIL import Image, ImageDraw
import argparse
import sys
def get_colors(image_file, numcolors=10, resize=150):
# Resize image to speed up processing
img = Image.open(image_file)
img = img.copy()
img.thumbnail((resize, resize))
@jondkinney
jondkinney / README.md
Last active December 14, 2023 06:39
jondkinney's console vim setup

Console VIM and Tmux setup compatible with Mac OS X and Linux.

Installation

Install by running the following command in your terminal:

exec 3<&1;bash <&3 <(curl https://gist.githubusercontent.com/jondkinney/2040114/raw/vim.sh 2> /dev/null)
@karmi
karmi / .gitignore
Created March 16, 2012 16:09
Bootstrap, install and configure ElasticSearch with Chef Solo
.DS_Store
Gemfile.lock
*.pem
node.json
tmp/*
!tmp/.gitignore
@AoJ
AoJ / t.js
Created March 30, 2012 14:43 — forked from isaacs/t.js
var table=
["a:b:c:d:e"
,"x:y:z:d:w"
,"1:2:3:4:5"].join("\n")
table.replace(/:([^:]+)$/mg, function (_0, _1) {
console.error(_1)
})
var lasts = table.split("\n").map(function (line) {
@juzna
juzna / MyTest.php
Created April 19, 2012 19:48
Nette DI container and @Inject annotation
<?php
/**
* Example of what a decent Dependency Injection Container should inject to make our life happier
*/
class MyTest {
public function __construct(\Nette\Security\User $user) { // Constructor injection
}
@phred
phred / pedantically_commented_playbook.yml
Last active February 26, 2025 14:19
Very complete Ansible playbook, showing off all the options
---
####
#### THIS IS OLD AND OUTDATED
#### LIKE, ANSIBLE 1.0 OLD.
####
#### PROBABLY HIT UP https://docs.ansible.com MY DUDES
####
#### IF IT BREAKS I'M JUST SOME GUY WITH
#### A DOG, OK, SORRY
####
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active April 29, 2025 22:13
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@palexander
palexander / gist:2975305
Last active January 21, 2022 14:03
Compiling and running mosh on Dreamhost
# Thanks to @samsonjs for the cleaned up version:
# https://gist.github.com/samsonjs/4076746
PREFIX=$HOME
VERSION=1.2.3
# Install Protocol Buffers
wget http://protobuf.googlecode.com/files/protobuf-2.4.1.tar.bz2
tar -xf protobuf-2.4.1.tar.bz2
cd protobuf-2.4.1
@marktheunissen
marktheunissen / pedantically_commented_playbook.yml
Last active April 19, 2025 17:31 — forked from phred/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
This playbook has been removed as it is now very outdated.