Skip to content

Instantly share code, notes, and snippets.

View bongtrop's full-sized avatar

Pongsakorn Sommalai bongtrop

View GitHub Profile
@bongtrop
bongtrop / multiloginirc.pl
Created November 14, 2012 02:23
Fack people in irc chenel
#!/usr/bin/perl
use strict;
use warnings;
use IO::Socket;
sub random_name {
my @name=("Somsak","Somsee","Somchai","Sommay","Somrede","Sommud","Sombut","Somluk","Somji","Somga","Somtom","Sommanod","Som","Somsed","Somkaru");
my $random=$name[rand(@name)];
return $random;
}
@bongtrop
bongtrop / gist:5947724
Last active December 19, 2015 11:29
Test in numer
#include <stdio.h>
int main() {
int a=0,i=2;
int test[4][2];
a+=i;
test[0][0]=a;
test[0][1]=i;
@bongtrop
bongtrop / gist:5947785
Last active December 19, 2015 11:29
ACM PB#H By python
#!/usr/bin/python
num = raw_input("")
min = 1000000000
max = 0
for i in range(0,int(num)):
input = raw_input("")
input = input.split(" ")
@bongtrop
bongtrop / error.c
Last active December 19, 2015 15:48
Check Error Numer Subject
#include <stdio.h>
int main() {
float fsum1, fsum2;
double dsum1, dsum2;
int i,n;
printf ("%5s%11s%11s%11s%11s%15s%15s\n","N","Float S1","Float S2","Double S1","Double S2","Error S1","Error S2");
for (n=1000;n<=10000;n+=1000) {
fsum1=fsum2=dsum1=dsum2=0;
#include <iostream>
#include <string>
#include <cstring>
using namespace std;
//reverse string
string bt_reverse(string input) {
return string(input.rbegin(),input.rend());
}
@bongtrop
bongtrop / bign.cpp
Last active December 19, 2015 17:28
Big Number add and multi
#include <iostream>
#define OVERFLOW 2
#define ROW b_len
#define COL a_len+b_len+OVERFLOW
using namespace std;
string add (string &s1, string &s2){
int carry=0,sum,i;
@bongtrop
bongtrop / Bongtrop Ball
Created August 22, 2013 07:35
Test ucigame Bongtrop Ball
import ucigame.*;
public class Pong extends Ucigame
{
Sprite ball;
Sprite paddle;
boolean checkDrag;
public void setup()
{
@bongtrop
bongtrop / ark1.c
Last active December 22, 2015 05:19
การบ้านพะเยา
#include <stdio.h>
#include <stdlib.h>
int cmp_array(const void *a, const void *b) {
int *aa=(int *)a;
int *bb=(int *)b;
return aa[0] - bb[0];
}
int main() {
@bongtrop
bongtrop / hw_numerandbisec
Last active December 23, 2015 03:09
Find position
#include <stdio.h>
#include <math.h>
const double ROOT3 = 1.73205080756887729352744634150587236694280525381;
double f(double x) {
return (x*x - 3);
}
double df(double x) {
@bongtrop
bongtrop / RoboCub
Last active December 25, 2015 01:39
Link Library For Python 2.7
http://sourceforge.net/projects/pywin32/
http://pyserial.sourceforge.net/
http://www.wxpython.org/download.php#stable
http://www2.fibo.kmutt.ac.th/fiboweb/2013/index.php/th/th-research/fibo-opensource-th/menu-open-fibopylibs-th