Skip to content

Instantly share code, notes, and snippets.

@hhc0null
hhc0null / .gdbinit
Created September 12, 2014 09:50
PEDA使えない環境?
# ~/.gdbinit
# show the 4 instructions include the next instruction to be executed.
display/4i $pc
# show the current EFLAGS.
display/t $ps
display/16wx $ebp - 0x20
display/16wx $esp
display/x $edi
display/x $esi
@hhc0null
hhc0null / to_raw_unicode_escape.py
Last active January 1, 2016 18:39
this is a solver code for the PyExec of 30C3 CTF.
#!/usr/bin/env python2
from binascii import hexlify,unhexlify
code1 = """
import os
print str(os.listdir('.'))
"""
@hhc0null
hhc0null / func_args
Created December 28, 2013 15:44
function arguments on x86_64
Function Arguments: RDI, RSI, RDX, RCX, R8, R9
@hhc0null
hhc0null / call_main
Created December 28, 2013 13:59
debugging on x86_64
0x00007ffff780ccae in __libc_start_main () from /lib64/libc.so.6
10: /x $eax = 0xf7b7ef60
9: /x $ecx = 0x0
8: /x $edx = 0xffffe658
7: /x $ebx = 0x400e90 # <- main address
6: /x $esi = 0xffffe648
5: /x $edi = 0x1
2: /t $ps = 1000000110
1: x/4i $pc
=> 0x7ffff780ccae <__libc_start_main+142>: callq *%rbx # call main
@hhc0null
hhc0null / fizzbuzz_20131028.c
Created October 27, 2013 16:36
i did my best...turai...
char b[10];
void fizzbuzz(int x){for(int i=1;i<=x;i++){sprintf(b,"%d",i),printf("%s\n",i%15?i%3?i%5?b:"buzz":"fizz":"fizzbuzz");}}
void main(int c,char **v) {fizzbuzz(atoi(v[1]));}
@hhc0null
hhc0null / 0011.cpp
Created August 10, 2013 05:48
AOJ0011
// AOJ0011 ACed
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <string>
using namespace std;
@hhc0null
hhc0null / 0010.cpp
Created August 10, 2013 05:46
AOJ0010
#include <cmath>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <stack>
#include <list>
#include <vector>
using namespace std;
@hhc0null
hhc0null / tribonacci.scm
Created July 25, 2013 05:41
put tribonacci numbers out with the tail recursion algorithm.
; put tribonacci numbers out with the tail recursion algorithm
(define (tribonacci n)
(tribo-tail n 0 0 1))
(define (tribo-tail n a b c)
(cond
((= n 0) or (= n 1) 0)
((= n 2) c)
(else
; Calc a distance of a thrown object
(define pi (* 4 (atan 1.0))) ; pi = 4atan(-1)
(define gravaccr 9.8) ; gravitial accelaration
(define CalcDistance
(lambda (v0 deg)
(define DegreeToRadian
(lambda (degree)
(/ (* degree pi) 180)))
(define CalcDistanceX
@hhc0null
hhc0null / AOJ0009.cpp
Created April 25, 2013 11:42
i want to take a bath immediately.
#include <cmath>
#include <iostream>
#include <iomanip>
#include <stack>
#include <list>
#include <vector>
int main(void) {
std::list<int> input;
std::vector<int> pnums;