Skip to content

Instantly share code, notes, and snippets.

@seungjin
seungjin / gist:1520433
Created December 26, 2011 02:40
check_time_sync.rb
def check_time_sync
require 'net/telnet'
time_server = 'time.bora.net'
options = {
"Host" => time_server,
@seungjin
seungjin / gist:1520412
Created December 26, 2011 02:24
get time over the web
require 'net/telnet'
TIME_SERVER = 'time.bora.net'
options = {
"Host" => TIME_SERVER,
"Telnetmode" => false,
"Timeout" => 30,
"Port" => "time"
}
@seungjin
seungjin / xdate.py
Created December 4, 2011 04:43
xdate; python extended date unix command
#!/usr/bin/env python
# extended date command for *nix / writtern in python
# Copyright (c) 2011-2012, Seung-jin Kim, All right reserverd
# Twitter: @seungjin
import sys
import time
from time import gmtime, strftime
@seungjin
seungjin / gist:1390204
Created November 23, 2011 23:09
get my ip num
#!/usr/bin/env ruby
require 'socket'
def local_ip
orig, Socket.do_not_reverse_lookup = Socket.do_not_reverse_lookup, true
UDPSocket.open do |s|
s.connect '8.8.8.8', 1
name_jar = [
'calvin',
'tom',
'tomase',
'justin',
#!/bin/bash
img_bucket_name='admin_mi_iBEEvm_20110824_171605'
cur_dir=`pwd`
echo $cur_dir
source $cur_dir/odin-admin-x509/eucarc
@seungjin
seungjin / atmo_boot.rb
Created November 4, 2011 02:40
atmo_boot script
##
## All files that are a part of this project, unless explicitly noted otherwise,
## are covered by the following license:
##
## Copyright (c) 2011, The Arizona Board of Regents on behalf of The University
## of Arizona
##
## All rights reserved.
##
## Developed by: iPlant Collaborative as a collaboration between participants at
#sorting in python
#http://www.daniweb.com/software-development/python/code/216689
# timing 7 different Python sorting algorithms with a list of integers
# each function is given the same list (fresh copy each time)
# tested with Python24 vegaseat 21jan2006
import random # for generating random numbers
import time # for timing each sort function with time.clock()
## {{{ http://code.activestate.com/recipes/577793/ (r1)
#!/usr/bin/env python
import os
import time
username = 'root'
defaultdb = 'postgres'
port = '5433'
backupdir='/www/backup/'
date = time.strftime('%Y-%m-%d')
import json
r = """ {
"result" : {
"code" : "success" ,
"meta" : "" ,
"value" : [{ "image_name" : "", "image_description" : "", "image_tags" : "no tags", "image_id" : "emi-B2711E5D" , "image_location" : "seungjin_mi_atmoboot_test/admin_mi_CBSU_workshop_20110519.img.manifest.xml" , "image_ownerid" : "seungjin" , "image_state" : "available" ,"image_is_public" : "private" ,"image_product_codes" : "[]" ,"image_architecture" : "x86_64" ,"image_type" : "machine","image_ramdisk_id" : "eri-B6B91781","image_kernel_id" : "eki-DB23180A", "image_condition" : "", "image_type" : "" , "image_condition" : "" }, { "image_name" : "", "image_description" : "", "image_tags" : "no tags", "image_id" : "emi-4F911F48" , "image_location" : "admin_mi_CBSU_workshop_20110520_001/admin_mi_CBSU_workshop_20110520.img.manifest.xml" , "image_ownerid" : "admin" , "image_state" : "available" ,"image_is_public" : "private" ,"image_product_codes" : "[]" ,"image_architecture" : "x86_64" ,"image_type" : "machine","imag