Skip to content

Instantly share code, notes, and snippets.

Jeff Tchang tachang

Block or report user

Report or block tachang

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@tachang
tachang / network-restart.sh
Created Apr 10, 2015
Cleanly restart the default libvirt network
View network-restart.sh
#!/bin/bash
#
# Yury V. Zaytsev <yury@shurup.com> (C) 2011
#
# This work is herewith placed in public domain.
#
# Use this script to cleanly restart the default libvirt network after its
# definition have been changed (e.g. added new static MAC+IP mappings) in order
# for the changes to take effect. Restarting the network alone, however, causes
# the guests to lose connectivity with the host until their network interfaces
@tachang
tachang / smtpforwarder.py
Created Aug 31, 2018
SMTP Forwarding Script
View smtpforwarder.py
import smtpd
import asyncore
class CustomSMTPServer(smtpd.SMTPServer, object):
def process_message(self, peer, mailfrom, rcpttos, data):
print 'Receiving message from:', peer
print 'Message addressed from:', mailfrom
print 'Message addressed to :', rcpttos
print 'Message length :', len(data)
@tachang
tachang / gist:2117833a395504bae0bde9979f4e201e
Created Mar 10, 2017
How to install NodeJS without root
View gist:2117833a395504bae0bde9979f4e201e
wget https://nodejs.org/dist/v6.10.0/node-v6.10.0-linux-x64.tar.xz
tar xvfJ node-v6.10.0-linux-x64.tar.xz
echo 'export PATH=$HOME/node-v6.10.0-linux-x64/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
@tachang
tachang / CameraToMpegTest.java
Created Jun 17, 2014
CameraToMpegTest.java
View CameraToMpegTest.java
/*
* Copyright 2013 The Android Open Source Project
*
* 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
@tachang
tachang / load_database.sh
Created Dec 19, 2017
Scripts that loads a database from S3
View load_database.sh
#!/bin/bash
# This script looks for a database container and reloads the database
# inside the container
DB_CONTAINER_ID=`docker ps --filter="ancestor=postgres:9.6" -q`
read -p "Enter Amazon Access Key: " AMAZON_ACCESS_KEY
read -p "Enter Amazon Secret Key: " AMAZON_SECRET_KEY
@tachang
tachang / ReactControlledInputWithState.jsx
Created Dec 14, 2017 — forked from markerikson/ReactControlledInputWithState.jsx
React controlled input with internal state example
View ReactControlledInputWithState.jsx
class ControlledInputWithInternalState extends Component {
constructor(props) {
super(props);
this.state = {
isValid : true,
value : props.value
};
}
@tachang
tachang / gist:ad8c2d0548e59ce353773ca75a5006c1
Created Jul 26, 2016
Hacky way to get it to require js format
View gist:ad8c2d0548e59ce353773ca75a5006c1
/**
* CSS conic-gradient() polyfill
* By Lea Verou — http://lea.verou.me
* MIT license
*/
var cg;
(function(){
@tachang
tachang / fabfile.py
Created Apr 21, 2013
Fabfile to setup a new application server
View fabfile.py
from fabric.api import *
from fabric.context_managers import *
from fabric.contrib.files import *
import fabtools.require.git
import fabtools
def install_packages():
packages = ['build-essential','git-core','python-dev']
with settings(user='root', key_filename='./root-deploy.key'):
View gist:5421436
display_meeting_instructions = False
if user_can_edit:
display_meeting_instructions = True
if request.user.is_authenticated() and Ticket.objects.filter(event=event, user=request.user).exists():
display_meeting_instructions = True
{% if display_meeting_instructions and event.meeting_instructions %}
{{ event.meeting_instructions }}
{% endif %}
@tachang
tachang / gist:cc1ab7100762f10d0e30
Created Nov 15, 2015
Chicktech Robotics Workshop Notes
View gist:cc1ab7100762f10d0e30
May need to give world read/write permissions to Arduino device:
chmod o+rw /dev/ttyUSB0
You can’t perform that action at this time.