Skip to content

Instantly share code, notes, and snippets.

View khajer's full-sized avatar

itsara khajer

View GitHub Profile
@khajer
khajer / note.txt
Created January 28, 2018 07:58
note
#-------------------------------------
// monitor
kubectl proxy -p 8080 -w .
//http://127.0.0.1/ui
@khajer
khajer / server.go
Created January 27, 2018 05:14
server.go
package main
import (
"fmt"
"net/http"
)
func HelloHandlers(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello, world.")
}
@khajer
khajer / main.go
Last active December 15, 2017 04:14
simple go http server.
package main
import (
"fmt"
"net/http"
)
func Handler(writer http.ResponseWriter, request *http.Request) {
fmt.Fprintf(writer, "Hello, world ")
}
@khajer
khajer / gist:89bb65c11cc735adcfe9dcb7774759ae
Last active August 30, 2016 04:47
local timezone android
/*
// method checkList timezone
private void checkListTimeZone(){
String[]TZ = TimeZone.getAvailableIDs();
for(int i = 0; i < TZ.length; i++) {
Log.d("TIMEZONE", TimeZone.getTimeZone(TZ[i]).getID());
}
}
*/
@khajer
khajer / gist:6206332
Last active December 20, 2015 22:39
python + opencv : test camera
import cv
cv.NamedWindow("testcam", cv.CV_WINDOW_AUTOSIZE)
camera_index = 0
capture = cv.CaptureFromCAM(camera_index)
def repeat():
global capture #declare as globals since we are assigning to them now
@khajer
khajer / gist:6206108
Created August 11, 2013 17:48
install opencv on mac.
sudo port install python27
sudo port select --set python python27
sudo port install py27-numpy
sudo port install opencv +python27
# add export file
sudo /Applications/TextEdit.app/Contents/MacOS/TextEdit ~/.bash_profile
#or
open -t ~/.bash_profile
@khajer
khajer / gist:6115271
Last active December 20, 2015 10:20
resize (*2) all image path for -hd. powered by python and pil
import Image
import os
listfile = os.listdir(os.getcwd())
scale = 2
for f in listfile:
if f.split('.')[1] == 'png':
print f
@khajer
khajer / gist:1216159
Created September 14, 2011 09:11
feed xml tag
var f = Titanium.Filesystem.getFile( Titanium.Filesystem.resourcesDirectory,
'issues/0/data.xml'
);
var fdata = f.read();
var xml = Titanium.XML.parseString(fdata.text);
var imagesFile = [];
@khajer
khajer / gist:1166087
Created August 23, 2011 18:35
titanium database connect
var db = Titanium.Database.open('imagazine');
//db.execute('drop database imagzine'); // for clear old
//db.execute('insert into books (book_id, issue_name, cover_image, book_name, download_completed) values(1,"101","issues/0/cover.jpg","car",1)');
var rows = db.execute('select * from books where download_completed = 1');
while (rows.isValidRow()){
/*
alert(rows.fieldByName('book_id'));
@khajer
khajer / gist:1165939
Created August 23, 2011 17:28
read sqlite file
//feed for database
// -------
var db = Ti.Database.install('../book.sqlite','db_name');
var rows = db.execute('select * from books where download_complete = 1');
var arrBook = [];
while (rows.isValidRow()){
//rows.fieldByName('issue_name');
rows.next();
}