Skip to content

Instantly share code, notes, and snippets.

View zikosw's full-sized avatar

Supakorn Warodom zikosw

View GitHub Profile
@zikosw
zikosw / lex.yy.c
Last active August 29, 2015 14:13
CC HW with Flex
#line 3 "lex.yy.c"
#define YY_INT_ALIGNED short int
/* A lexical scanner generated by flex */
#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 5
@zikosw
zikosw / hw2.c
Created January 20, 2015 15:23
CC HW2 Flex
%option noyywrap
D [0-9]
L [a-zA-Z_]
H [a-fA-F0-9]
E [Ee][+-]?{D}+
FS (f|F|l|L)
IS (u|U|l|L)*
%{
@zikosw
zikosw / .vimrc
Last active August 29, 2015 14:15
vimrc old file gone some where
" fix bg problem in tmux
set t_ut=
" Note: Skip initialization for vim-tiny or vim-small.
if !1 | finish | endif
if has('vim_starting')
if &compatible
set nocompatible " Be iMproved
endif
@zikosw
zikosw / training.java
Last active August 29, 2015 14:16
try weka MLP
package supervis;
import java.io.FileReader;
import weka.classifiers.Evaluation;
import weka.classifiers.functions.MultilayerPerceptron;
import weka.core.Instance;
import weka.core.Instances;
import weka.core.Utils;
public class training {
@zikosw
zikosw / rfos4disk.c
Created April 18, 2015 16:15
os'rfos
void mirrorWrite(int diskGroup,void* data,guint64 addr,guint size){
if(diskGroup==0){ // first
if(newDisk[0]==FALSE){
editFile(diskFileName[0],data,addr,size);
}else{
printf("D0 is new\n");
}
if(newDisk[1]==FALSE){
@zikosw
zikosw / Authen.js
Last active March 15, 2018 15:32
KMITL Web Auto Authen
// ==UserScript==
// @name Login KMITL
// @namespace http://userscripts.org/users/useridnumber
// @include https://161.246.254.213/dana-na/auth/url_default/welcome.cgi*
// @include https://161.246.254.213/dana-na/auth/welcome.cgi*
// @include https://161.246.254.213/dana/home/infranet.cgi*
// ==/UserScript==
function Check_Login() {
@zikosw
zikosw / cloud-config
Last active August 29, 2015 14:23
cloud-config
#cloud-config
ssh_authorized_keys:
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC3WQWXS/ICnLU0X/abycpn6gGFr2d0hN9Sy1HNwE/0ckE48oroOddRnh6CuxCQYvKetVZ8WSrL5uMGkFu08LmSNFnk6qIpEVWAp5J2b0sbjKEPsQ31nydeDjRWHi+wDClDANKmNgm29xpCMjd0P4jWFhm8rwIdGvsOMDygJezs5+VwitQmLOOkhqo16wfb82hzlU86qQiIMg0uF3Sea69qANLYcRDp2JtuVuDw7yuGiP/AY1UkV9TRghu5EKDxorQh57tgYKmvB0ECeu4rzXbOHV0MFWQQJuhvp+r4G+p5+a+mvqj85pGerq5tMofTR7DM69Ft6snCyn/Sl56oNIQZ ionization@hp1
coreos:
etcd2:
# generate a new token for each unique cluster from https://discovery.etcd.io/new?size=3
# specify the initial size of your cluster with ?size=X
# WARNING: replace each time you 'vagrant destroy'
discovery: https://discovery.etcd.io/b03caca9c94181177cee5b2161eaf2d6
@zikosw
zikosw / synaptic
Created June 25, 2015 11:31
synaptic touchpad
Option "TapButton1" "1"
Option "TapButton2" "3"
Option "TapButton3" "2"
Option "VertTwoFingerScroll" "on"
Option "HorizTwoFingerScroll" "on"
Option "CircularScrolling" "on"
Option "CircScrollTrigger" "2"
Option "VertScrollDelta" "-111"
Option "HorizScrollDelta" "-111"
Option "PalmDetect" "1"
sudo iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
sudo iptables -A FORWARD -i eth1 -o eth0 -m state -–state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i eth0 -o eth1 -j ACCEPT
if($media_type == "braille") {
$media = Braille::find($media_id);
$lastItem = Brailledetail::where('braille_id', '=', $media_id)->get();
$currentAmount = $lastItem->last()->part;
if($amount - $currentAmount > 0) {
for($i=$currentAmount + 1; $i<=$amount; $i++){
$brailledetail = new Brailledetail();
$brailledetail->part = $i;
$brailledetail->status = 0;
$brailledetail->date = (date("Y") + 543).date("-m-d H:i:s");