Skip to content

Instantly share code, notes, and snippets.

from PIL import Image
import requests
import os
from threading import Thread
from Queue import Queue
root = 'http://microsculpture.net/assets/img/tiles'
tiles = 'highres_orchid_%20cuckoo_bee_side_view'
# Another is highres_tortoise_beetle
@Stovoy
Stovoy / Stranded change WIP
Created April 27, 2016 19:05
kingpin/actors/rightscale/server_array.py
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
@Stovoy
Stovoy / color_string_generator.py
Created October 20, 2016 07:36
Why'd I do this?
import base64
import gzip
import StringIO
bs = '\\x08'
phrase = 'swaggy'
colors = ['\e[31m', '\e[32m', '\e[33m',
'\e[34m', '\e[35m', '\e[36m',
'\e[37m', '\e[90m', '\e[91m',
'\e[92m', '\e[93m', '\e[94m',
@Stovoy
Stovoy / docker_image_size.sh
Last active April 29, 2017 03:26
Calculate a docker image's total size.
function docker_image_size() {
local image=$1
local sum=0
local value
for line in $(docker history $image | tail -n +2 | awk '{print $(NF-1) "-" $NF}'); do
if [[ "$(echo $line | awk -F'-' '{print $2}')" == "B" ]]; then
value=$(echo $line | awk -F'-' '{print $1}')
elif [[ "$(echo $line | awk -F'-' '{print $2}')" == "kB" ]]; then
kb=$(echo $line | awk -F'-' '{print $1}')
value=$(echo "$kb * 1024" | bc -l)
@Stovoy
Stovoy / color-uniques.sh
Last active May 23, 2017 01:32
Color unique lines from stdout.
function color_uniques() {
colors=("\033[0;39m" "\033[0;31m" "\033[0;32m" "\033[0;33m" "\033[0;34m" "\033[0;35m" "\033[0;36m" "\033[0;37m" "\033[0;90m" "\033[0;91m" "\033[0;92m" "\033[0;93m" "\033[0;94m" "\033[0;95m" "\033[0;96m" "\033[0;97m")
max_unique=16
declare -a unique_lines
while read line; do
color=""
found=false
for unique_line in "${unique_lines[@]}"; do
if [[ "$unique_line" == "$line" ]]; then
@Stovoy
Stovoy / tmux.md
Last active November 18, 2017 00:18
Dev Tools Tip Of The Week #3

Dev Tools Tip Of The Week #3

Maximize terminal efficiency with tmux

Tired of typing cd vagrant/dev, vagrant ssh, and waiting for the connection?

Tired of searching among 8 terminal windows for the one running your server?

Tired of only being able to see one thing at a time, or having to click around with the mouse?

You're not alone. Fortunately for all of us, tmux is there to help. Using a terminal multiplexer like tmux (literally terminal multiplexer) can be a massive time saver and productivity booster.

// I put this into renderer.js before the actual rendering.
const context = this.context;
const drawGems = (winCount, hatName, x, y) => {
const hatImage = Images.getImage('hats/' + hatName);
const drawHat = () => context.drawImage(hatImage,
x - 50 / 2,
y - 50 / 2);
import argparse
import pprint
import sys
import yaml
parser = argparse.ArgumentParser(description='Konfig configures Kubernetes resources dynamically.')
parser.add_argument('-f', '--input_file', dest='input_file_paths', action='append')
parser.add_argument('-r', '--add-resource', dest='resource_file_paths', action='append')
parser.add_argument('-p', '--add-patch', dest='patch_file_paths', action='append')
CorrectHorseBatteryStaple -> server
is_valid_password?
database .. is that right?
!!!! no !!!!
don't put passwords in the database
if your database gets leaked all the passwords are exposedf! everyone is exposed!
RUIN! DESTRUCTION! CATACLYSM! CATASTROPHIC
so what do then
"""
What IS Asyncio?
Normally, when a program runs, it executes instructions.
The program will execute instructions 1 at a time.
Instructions are like this:
x = 1