Skip to content

Instantly share code, notes, and snippets.

@op01
op01 / try-gist
Created September 26, 2013 13:45
hello gist
y/A-Za-z/a-zA-Z/,print while(<>)
#include<cstdio>
#include<cstdlib>
int main()
{
int n;
scanf("%d",&n);
int arr[n];
int max=0;
for(int i=0;i<n;i++)
{
#include<iostream>
#include<cstdlib>
#include<ctime>
#include<cmath>
#include<unistd.h>
#include<cstdio>
#include<sstream>
#include<string.h>
using namespace std;
sub getContent
{
open FH,shift;
$content = '';
$content.=$_ while(<FH>);
return $content;
}
sub sar
{
$txt = shift;
#include<cstdio>
#include<queue>
using namespace std;
struct container
{
int a;
int b;
};
bool operator<(container a,container b)
{
@op01
op01 / monkey.py
Created May 13, 2014 16:10
TOI10th day1 monkey
class Bar:
def __init__(self,s):
p,h = s.split(' ')
self.p = int(p)
self.h = int(h)
n,m,k = (int(i) for i in input().split(' '))
b = [int(i) for i in input().split(' ')[0:m]]
bars = [Bar(input()) for i in range(k)]
st = int(input())
st-=1

SQL Cheat Sheet

CRUD

  1. Create
  • insert (all colunms)
insert into T values(V1,V2,V3)
@op01
op01 / websocket-server.py
Created May 6, 2015 10:52
simple echo websocket server implement in python
import socket,select,time,re,base64,hashlib
def debug(b):
print("txt:")
print(b)
# print(b.decode('UTF-8'),end='')
print("ENDtxt")
def getAll(cs):
ret = bytes()
while len(select.select([cs],[],[],0)[0]):
recv=cs.recv(10)
@op01
op01 / adm58.py
Last active August 29, 2015 14:21
admission 58 regno finder
import requests,threading,time,sys
idnum = sys.argv[1]
MAX = 8200000
N=10
threads = [None] * N
results = [None] * N
def post(reg,idcard):
try:
result=requests.post('http://admission.cuas.or.th/adm58/findpdf_result.php',{'regno':str(reg),'pplid':str(idcard),'submit':'ค้รหาใบสมัคร'})
except requests.exceptions.ConnectionError: