Skip to content

Instantly share code, notes, and snippets.

View choestelus's full-sized avatar
💤
daydreaming

Nattapong Amornbunchornvej choestelus

💤
daydreaming
View GitHub Profile
@choestelus
choestelus / 282A.py
Last active December 16, 2015 23:19
str = input()
inpt = ""
n = int(str)
x = 0
for i in range(n):
inpt = input()
if(inpt[0:2] == "++" or inpt[1:3] == "++"):
x += 1
elif(inpt[0:2] == "--" or inpt[1:3] == "--"):
x -= 1
@choestelus
choestelus / 12B.cpp
Last active December 16, 2015 23:49
g++ 4.7.2 [-std=c++11] python 3.3 (:
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int countzero(const string in)
{
int count = 0;
for(int i=0; i<in.length(); i++)
{
if(in[i] == '0')
@choestelus
choestelus / lab0.cpp
Created June 13, 2013 09:47
Lab 0 didn't detect for special case (e.g. all bun have same numbers).
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <string>
using namespace std;
void drawTriangle(int);
void printNum(int);
int digitSum(int);
int sumDigit(int);
@choestelus
choestelus / lab2.cpp
Created June 28, 2013 09:46
[incomplete] data structure, lab2
#include <iostream>
#include <cstdlib>
#include "linkedlist.hpp"
using namespace std;
template<class T>
void cut(LinkedList<T> *&list, int percent);
template<class T>
void shuffle(LinkedList<T> *&list, int percent);
# nginx server block example
server {
listen 80;
server_name localhost;
set $root_path 'html/Scrum-Framework/scrumframework/public';
root $root_path;
index index.php index.html index.htm;
@choestelus
choestelus / _vimrc
Created September 16, 2014 14:03
choestelus's gvim's vimrc configuration
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/vimfiles/bundle/Vundle.vim/
let path='~/vimfiles/bundle'
call vundle#begin(path)
" let Vundle manage Vundle, required
@choestelus
choestelus / generatorZp.py
Created December 18, 2014 03:43
find list of generator in Zp*
def testgen(total_num):
return len(total_num) == len(set(total_num))
def test_z(generator_num, n):
bag = []
for i in range(1, n):
t = pow(generator_num, i, n)
bag.append(t)
return testgen(bag)
.global main
.text
main:
push %rbp
mov %rsp, %rbp
sub $104, %rsp
xor %rax, %rax
cmp $1, %rax
@choestelus
choestelus / nginx.spec
Last active August 29, 2015 14:21
custom nginx-1.8.0 + modsecurity-2.9.0 build file configuration
#
%define nginx_home %{_localstatedir}/cache/nginx
%define nginx_user nginx
%define nginx_group nginx
%define nginx_loggroup adm
%define modsec_version 2.9.0
# distribution specific definitions
%define use_systemd (0%{?fedora} && 0%{?fedora} >= 18) || (0%{?rhel} && 0%{?rhel} >= 7) || (0%{?suse_version} == 1315)
@choestelus
choestelus / triangle.html
Last active September 6, 2015 12:37
Triangle type specifier
<html>
<head>
<title>
Triangle Type Resolver
</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/snap.svg/0.4.1/snap.svg-min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
</head>