Skip to content

Instantly share code, notes, and snippets.

View chrishuan9's full-sized avatar
🎯
Focusing

Chris Huang chrishuan9

🎯
Focusing
View GitHub Profile
@chrishuan9
chrishuan9 / gist:d26f4bec9dd9a8c0a6f851aa24047db2
Created November 24, 2016 08:22 — forked from sgergely/gist:3793166
Midnight Commander Keyboard Shortcuts for Mac OSX
----- Esc -----
Quick change directory: Esc + c
Quick change directory history: Esc + c and then Esc + h
Quick change directory previous entry: Esc + c and then Esc + p
Command line history: Esc + h
Command line previous command: Esc + p
View change: Esc + t (each time you do this shortcut a new directory view will appear)
Print current working directory in command line: Esc + a
Switch between background command line and MC: Ctrl + o
Search/Go to directory in active panel: Esc + s / Ctrl + s then start typing directory name
@chrishuan9
chrishuan9 / gist:29f91cde8c09e97a8a5a1ef90c6186ff
Created May 18, 2016 11:59 — forked from jayjanssen/gist:5697813
Testing multicast with iperf
this is a sample of output:
root@percona-db-2:~# iperf -s -u -B 226.94.1.1 -i 1
------------------------------------------------------------
Server listening on UDP port 5001
Binding to local address 226.94.1.1
Joining multicast group 226.94.1.1
Receiving 1470 byte datagrams
UDP buffer size: 122 KByte (default)
------------------------------------------------------------
@chrishuan9
chrishuan9 / NTFSPermissions.ps1
Created December 31, 2015 08:43
Bulk add NTFS permission to a list of folders.
http://nopaste.info/cac839a765.html#===========================================================================================
# AUTHOR: Tao Yang
# DATE: 01/07/2010
# Version: 1.0
# COMMENT: Bulk add NTFS permission to a list of folders.
# Usage: .\BulkSet-NTFSPermissions.ps1 -FolderListFile xxxxxx\xxxx.txt -SecIdentity "Domain\Group" -AccessRights "FullControl" -AccessControlType "Allow"
#===========================================================================================
param (
[string]$FolderListFile = $(throw "Plese specify the folder list file using -FolderListFile switch."),
@chrishuan9
chrishuan9 / firmata_example.py
Created June 1, 2015 14:06
Firmata Example
#! /usr/bin/env python
"""pyduino - A python library to interface with the firmata arduino firmware.
Copyright (C) 2007 Joe Turner <[email protected]>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
@chrishuan9
chrishuan9 / webm.md
Last active August 29, 2015 14:13 — forked from ndarville/webm.md
converting gifs to web

Grab ffmpeg from https://www.ffmpeg.org/download.html

OSX Users: Install ffmpeg using homebrew:

brew install ffmpeg --with-libvpx

respectively, if you already have ffmpeg installed without libvpx encoder

brew reinstall ffmpeg --with-libvpx
@chrishuan9
chrishuan9 / buildingUIs.py
Created November 4, 2014 20:17
Python 2: Lesson 9: Building UIs
__author__ = 'chris'
import os
import logging
"""
Starting with the project you created at the end of the last lesson,
add components to the existing framework so that:
-- When the areas occupied by Frame 1 or Frame 2 are clicked
with mouse button 1, the program should print which frame was clicked
and the X and Y coordinates (relative to the Frame).
@chrishuan9
chrishuan9 / myappInitDScript
Last active August 29, 2015 14:06
chkconfig compatible startup script (tested on Xubuntu 11.10 and CentOS 5.5)
#!/bin/bash
# myapp daemon
# chkconfig: 345 20 80
# description: myapp daemon
# processname: myapp
DAEMON_PATH="/home/wes/Development/projects/myapp"
DAEMON=myapp
DAEMONOPTS="-my opts"

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import re
from lxml import etree
import StringIO
import sys
reload(sys)
@chrishuan9
chrishuan9 / libreoffice
Created June 30, 2014 16:12
Remove every nth line in Libreoffice Calc document
REM ***** BASIC *****
Sub Main
dim sStartRowInput as String
dim sEndRowInput as String
dim startRow as Integer
dim endRow as Integer
dim stepCount as Integer
dim sheetName as String