Skip to content

Instantly share code, notes, and snippets.

View zikosw's full-sized avatar

Supakorn Warodom zikosw

View GitHub Profile
@zikosw
zikosw / .vimrc
Created September 16, 2014 15:27
.vimrc unix
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
@zikosw
zikosw / 000-default.conf
Created September 20, 2014 08:58
apache2 config : laravel
<VirtualHost *:80>
ServerName localhost
ServerAdmin admin@web.com
DocumentRoot /var/www/html/laravel/public
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/html/laravel/public/>
Options Indexes FollowSymLinks MultiViews
@zikosw
zikosw / wow asm
Created October 5, 2014 11:45
wow.c
int fact(int n){
if (n<1) return 1;
else
return n*fact(n-1);
}
fact:
SUB sp,sp,#8 ;Adjust stack for 2 times
STR lr,[sp,#4] ;Save return address
STR r0,[sp,#0] ;Save argument n
CMP r0,#1 ;compare n to 1
fact: ; fact 3 r0=3
SUB sp,sp,#8 ;Adjust stack for 2 times
STR lr,[sp,#4] ;Save return address
STR r0,[sp,#0] ;Save argument n
CMP r0,#1 ;compare n to 1 ; r0=3 ~~~ 1
;BGE L1
SUB r0,r0,#1 ;else decrement n
BL fact ;Recursive caller ; r0=2
SUB sp,sp,#8 ;Adjust stack for 2 times
@zikosw
zikosw / default-ssl.conf
Created October 13, 2014 15:35
apache ssl
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
ServerAdmin supagorn@kmi.tl
ServerName CEDD
ServerAlias cedd.cloudapp.net
DocumentRoot /var/www/html/laravel/public
<Directory />
Options FollowSymLinks
AllowOverride All
@zikosw
zikosw / Dijkstras.java
Last active August 29, 2015 14:08
Dijkstras with graph.csv
import java.util.PriorityQueue;
import java.util.List;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
import java.io.File;
import java.io.FileNotFoundException;
class Vertex implements Comparable<Vertex> {
public final String name;
@zikosw
zikosw / RSA.java
Created November 4, 2014 08:12
RSA TOC2
import java.math.BigInteger;
import java.security.SecureRandom;
public class RSA {
private static BigInteger n;
private static BigInteger d;
private static BigInteger e;
public static BigInteger randomPrimeBigIntegerRange(int bitLengthFrom, int bitLengthtTo){
SecureRandom rnd = new SecureRandom();
@zikosw
zikosw / rsa.go
Last active August 29, 2015 14:08
Simple RSA Algorithm
package main
import (
"fmt"
"math/big"
"time"
mRand "math/rand"
cRand "crypto/rand"
)
@zikosw
zikosw / leafbox.sql
Created November 6, 2014 14:31
leafbox blind lib
CREATE DATABASE IF NOT EXISTS `leafbox` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
USE `leafbox`;
CREATE TABLE IF NOT EXISTS `book` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`isbn` varchar(13) COLLATE utf8_unicode_ci DEFAULT NULL,
`title` text COLLATE utf8_unicode_ci NOT NULL,
`author` text COLLATE utf8_unicode_ci,
`translate` text COLLATE utf8_unicode_ci,
@zikosw
zikosw / routes.php
Created November 7, 2014 16:14
oh my routes
<?php
Route::pattern('id', '[0-9]+');
//,'https'=>'https'
Route::group(array(), function(){
//--Home
Route::group(array(), function(){
// Index
Route::get('/',array('as'=>'home','uses'=>'HomeController@showIndex'));
Route::get('home',array('uses'=>'HomeController@showIndex'));