Skip to content

Instantly share code, notes, and snippets.

Avatar
🥕

Wei-Bo Chen bananaappletw

🥕
View GitHub Profile
@bananaappletw
bananaappletw / .editorconfig
Created Aug 20, 2018
General Editorconfig
View .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
View qq.c
#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++;
View test.c
#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;
@bananaappletw
bananaappletw / remove-trailing-space.sh
Last active Jan 17, 2017
Recursively remove trailing space inside current directory with specific file extension
View remove-trailing-space.sh
# 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:]]\+$//'
@bananaappletw
bananaappletw / sum.c
Created Oct 27, 2016
Bamboofox club lecture
View sum.c
#include<stdio.h>
int sum(int i,int j)
{
int sum;
sum=i+j;
return sum;
}
int main(void)
{
int i;
@bananaappletw
bananaappletw / hello.asm
Created Oct 27, 2016
Bamboofox club lecture
View hello.asm
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 / practice.asm
Created Oct 27, 2016
Bamboofox club lecture
View practice.asm
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