Skip to content

Instantly share code, notes, and snippets.

View bananaappletw's full-sized avatar
🥕

Weibo Chen bananaappletw

🥕
View GitHub Profile
@bananaappletw
bananaappletw / hello.asm
Created October 27, 2016 03:44
Bamboofox club lecture
section .text
global _start ;must be declared for linker (ld)
_start: ;tell linker entry point
mov edx,len ;message length
mov ecx,msg ;message to write
mov ebx,1 ;file descriptor (stdout)
mov eax,4 ;system call number (sys_write)
int 0x80 ;call kernel
@bananaappletw
bananaappletw / sum.c
Created October 27, 2016 04:01
Bamboofox club lecture
#include<stdio.h>
int sum(int i,int j)
{
int sum;
sum=i+j;
return sum;
}
int main(void)
{
int i;
@bananaappletw
bananaappletw / practice.asm
Created October 27, 2016 03:39
Bamboofox club lecture
section .text
global _start ;must be declared for linker (ld)
_start: ;tell linker entry point
;You are going to practice system call
;What you should do?
;put system call number in %eax
;put fd number in %ebx
;put string address in %ecx
;put string length in %edx
;interrupt
@bananaappletw
bananaappletw / remove-trailing-space.sh
Last active January 17, 2017 20:01
Recursively remove trailing space inside current directory with specific file extension
# http://stackoverflow.com/questions/10711051/how-to-remove-trailing-whitespaces-for-multiple-files
# Remove trailing space inside current directory with file extension *.rb
find ./ -type f -name '*.rb' | xargs sed --in-place 's/[[:space:]]\+$//'
#include <stdio.h>
#include <stdlib.h>
char *serial = "\x31\x3e\x3d\x26\x31";
int check(char *ptr)
{
int i;
int hash = 0xABCD;
for (i = 0; ptr[i]; i++)
hash += ptr[i] ^ serial[i % 5];
return hash;
#include <stdio.h>
#include <stdlib.h>
char *serial = "\x31\x3e\x3d\x26\x31";
int check(char *ptr)
{
int i = 0;
while (i < 5){
if (((ptr[i] - 1) ^ 0x55) != serial[i])
return 1;
i++;
@bananaappletw
bananaappletw / .editorconfig
Created August 20, 2018 14:21
General Editorconfig
# EditorConfig is awesome: http://EditorConfig.org
# top-most EditorConfig file
root = true
[*]
# Unix-style newlines with a newline ending every file
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true