Skip to content

Instantly share code, notes, and snippets.

@Hyunho
Hyunho / tip.sh
Created Dec 10, 2014
nice tip for linux
View tip.sh
#Find Distribution Version
lsb_release -a
@Hyunho
Hyunho / extract_gap.py
Created Nov 13, 2014
MLOGC trace 로그에서시간과 gap을 출력할 수 있다.
View extract_gap.py
#!/usr/bin/python
import sys
import re
from datetime import datetime
import time
if hasattr(datetime, 'strptime'):
#python 2.6
strptime = datetime.strptime
View shared_memory.sh
# list shared memory that the owner is 'hyunho'
ipcs -m | grep hyunho
# remove shared memory that the owner is 'hyunho'
shmids=`ipcs -m | grep hyunho |awk '{print $2}'`; for shmid in ${shmids[0]}; do ipcrm -m $shmid ; done
@Hyunho
Hyunho / print network bandwidth.sh
Last active Aug 29, 2015
print network bandwidth in bit format at linux
View print network bandwidth.sh
#!/bin/sh
rx1=`grep eth0 /proc/net/dev | awk '{print $1}' | sed 's/.*://'`
tx1=`grep eth0 /proc/net/dev | awk '{print $9}'`
sleep 3
rx2=`grep eth0 /proc/net/dev | awk '{print $1}' | sed 's/.*://'`
tx2=`grep eth0 /proc/net/dev | awk '{print $9}'`
rx3=$(((rx2-rx1)/3*8/1024/1024))
tx3=$(((tx2-tx1)/3*8/1024/1024))
@Hyunho
Hyunho / 0_reuse_code.js
Created Dec 15, 2013
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@Hyunho
Hyunho / concurrently.sh
Created Dec 15, 2013
prevent that two same scripts run concurrently
View concurrently.sh
#!/bin/sh
PIDFILE=/tmp/update_index.pid
if [ -e $PIDFILE ]
then
PID=$(cat $PIDFILE)
PSCNT=$(ps -p $PID | grep -v CMD | wc -l)
View requests.py
"""
This is clone of requests python package
if server is inconvenience to install python package, I want to use this
"""
import urllib2
import urllib