Skip to content

Instantly share code, notes, and snippets.

@vtsatskin
vtsatskin / gist:d78d0f58f3cf440dc6c207b992f51e4f
Created June 13, 2017 21:12
Add loopback to Network pane in System Preferences on macOS
sudo networksetup -createnetworkservice Loopback lo0
sudo networksetup -setmanual Loopback 172.20.42.42 255.255.255.255
@vtsatskin
vtsatskin / Ubuntu rbenv
Created March 15, 2012 02:49 — forked from HatemMahmoud/Ubuntu rbenv
Installing Ruby 1.9.3 with OpenSSL on Ubuntu 11.04 using ruby-build and rbenv
# for more info: https://gist.github.com/1120938
@vtsatskin
vtsatskin / tkinter_key_event_debouncing.py
Created October 13, 2015 17:32
Listening to KeyPress and KeyRelease with Tkinter with debouncing
import Tkinter as tkinter
tk = tkinter.Tk()
has_prev_key_release = None
'''
When holding a key down, multiple key press and key release events are fired in
succession. Debouncing is implemented in order to squash these repeated events
and know when the "real" KeyRelease and KeyPress events happen.
@vtsatskin
vtsatskin / typescriptreact.json
Last active February 27, 2019 17:43
VS Code snippet for creating a React PureComponent in TypeScript
{
/*
// Place your snippets for TypeScript React here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
"Print to console": {
"prefix": "log",
"body": [
@vtsatskin
vtsatskin / frames_to_video.py
Created October 23, 2015 20:22
Saving numpy image frames to video with OpenCV
import cv2
import numpy as np
def save_frames(frames, file_path, width, height, fps, codec="mp4v"):
# Define the codec and create VideoWriter object
fourcc = cv2.cv.CV_FOURCC(*codec)
out = cv2.VideoWriter(file_path, fourcc, fps, (width,height))
for frame in frames:
out.write(frame)
@vtsatskin
vtsatskin / gist:dd2e3ca81125b6f3e061176744bd2f7f
Created August 22, 2017 18:35
Running Android emulator through the command line on OSX
# Add this to your shell profile
export ANDROID_HOME=$HOME/Library/Android/sdk/
alias emulator='cd $ANDROID_HOME/tools/; ./emulator'
# In a new shell
emulator @<avd_name>
➜ App git:(story-book) ✗ yarn --version (⌐•_•)
0.27.5
➜ App git:(story-book) ✗ node --version (⌐•_•)
v8.0.0
➜ App git:(story-book) ✗ react-native --version (⌐•_•)
react-native-cli: 2.0.1
react-native: 0.44.2

Keybase proof

I hereby claim:

  • I am vtsatskin on github.
  • I am vtask (https://keybase.io/vtask) on keybase.
  • I have a public key whose fingerprint is 61DB 3B91 BF7C CCA1 8498 E280 9B8E 4D3A 556F 3566

To claim this, I am signing this object:

@vtsatskin
vtsatskin / .gitignore
Last active December 30, 2015 16:09
Python global and user config variables + git. The idea behind this is that you have one central place to keep config variables with the option of having user-specific variables outside of user control. Useful for working with API keys and other sensitive data. Simply put user-specific variables in config_user.py.
config_user.py
@vtsatskin
vtsatskin / doge-term.sh
Last active December 29, 2015 05:58
Doges your terminal up
# Doges your terminal up
# Requires Mac OS X, lolcat, and thinderman's doge
# Doge: https://github.com/thiderman/doge
# lolcat: https://github.com/busyloop/lolcat
# Display a lovely doge
doge
# Alias for periodic pretty doge lines