Skip to content

Instantly share code, notes, and snippets.

@codehwang
codehwang / fabfile.py
Created December 13, 2017 18:40 — forked from roselleebarle04/fabfile.py
Simple django fabric script for deployment
import os
import sys
from fab_deploy import *
from fabric.contrib.console import confirm
from fabric.api import env, cd, prefix, local, sudo as _sudo, run as _run, hide, task, settings, abort
from fabric.contrib.files import exists, upload_template
from fabric.colors import yellow, green, blue, red
from fabric.operations import _prefix_commands, _prefix_env_vars
from contextlib import contextmanager
@codehwang
codehwang / Ansible install
Created December 7, 2017 04:43 — forked from dpalomar/Ansible install
Steps to install Ansible on Debian/Ubuntu
# base requirements
sudo apt-get update
sudo apt-get install -y software-properties-common
sudo apt-get install -y python-setuptools python-dev libffi-dev libssl-dev git sshpass tree
sudo easy_install pip
sudo -H pip install cryptography
# sudo -H pip install ansible==2.1.1.0 if you don't need virtualenv
# virtualenv
@codehwang
codehwang / README.md
Created December 7, 2017 04:25 — forked from trinitronx/README.md
A shell script to install latest Ansible via pip + dependencies

omnibus-ansible

Install latest Ansible via pip + dependencies via a shell script

This file is used to install ansible in test kitchen when you set in the kitchen.yaml file

require_ansible_omnibus: true

By default test kitchen will always download and use the latest version of this install file.

WARNING: AS SOON AS YOU MERGE CODE HERE IT IS INSTANTLY AVAILABLE TO EVERYONE DOING OMNIBUS KITCHEN ANSIBLE INSTALLS:

@codehwang
codehwang / gif.py
Created November 28, 2017 08:32 — forked from xyfeng/gif.py
python script turn images into gif
# From https://github.com/wnyc/PIL/blob/master/Scripts/gifmaker.py
#
# The Python Imaging Library
# $Id$
#
# convert sequence format to GIF animation
#
# history:
# 97-01-03 fl created
#
@codehwang
codehwang / images2gif.py
Created November 28, 2017 08:31 — forked from rogeruiz/images2gif.py
Static Images to Gif Python Script
""" MODULE images2gif
Provides a function (writeGif) to write animated gif from a series
of PIL images or numpy arrays.
This code is provided as is, and is free to use for all.
Almar Klein (June 2009)
- based on gifmaker (in the scripts folder of the source distribution of PIL)
@codehwang
codehwang / wget-alias.terminal
Created November 27, 2017 03:01 — forked from philiparthurmoore/wget-alias.terminal
Using a wget alias on Mac OS X
alias wget="curl -O --retry 999 --retry-max-time 0 -C -"
##
# Line should be placed at ~/.bash_profile
# Source: http://www.mymacosx.com/terminal/wget-replacement-macos.html
# Source: http://superuser.com/questions/142459/persistent-retrying-resuming-downloads-with-curl
##
@codehwang
codehwang / text2png.py
Created November 22, 2017 15:31 — forked from destan/text2png.py
Python text to image (png) conversion with automatic new line calculation
# coding=utf8
import PIL
from PIL import ImageFont
from PIL import Image
from PIL import ImageDraw
def text2png(text, fullpath, color = "#000", bgcolor = "#FFF", fontfullpath = None, fontsize = 13, leftpadding = 3, rightpadding = 3, width = 200):
REPLACEMENT_CHARACTER = u'\uFFFD'
NEWLINE_REPLACEMENT_STRING = ' ' + REPLACEMENT_CHARACTER + ' '
@codehwang
codehwang / snakecoin-server-full-code.py
Created November 20, 2017 16:39 — forked from aunyks/snakecoin-server-full-code.py
The code in this gist isn't as succinct as I'd like it to be. Please bare with me and ask plenty of questions that you may have about it.
from flask import Flask
from flask import request
import json
import requests
import hashlib as hasher
import datetime as date
node = Flask(__name__)
# Define what a Snakecoin block is
class Block:
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.