Skip to content

Instantly share code, notes, and snippets.

@perillamint
perillamint / randomstr.c
Created April 10, 2013 13:37
Random string generator.
//Released under GNU GPL v3.
#include <stdio.h>
static const char alphanum[] =
"0123456789"
"!@#$%^&*"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz";
@perillamint
perillamint / sscipher
Created September 23, 2013 17:10
욕먹을 사이퍼 코드
import java.util.Scanner;
public class Cipher {
private static char key[] = {
0x21, 0x40, 0x23, 0x24, 0x25, 0x5e, 0x26, 0x2a, 0x28, 0x29, 0x5f, 0x2d,
0x2b, 0x3d, 0x7c, 0x5c, 0x60, 0x7e, 0x7d, 0x7b, 0x5b, 0x5d, 0x27, 0x22,
0x3b, 0x3a, 0x3e, 0x3c, 0x3f, 0x2f, 0x71, 0x77, 0x65, 0x72, 0x74, 0x79,
0x0a
};
@perillamint
perillamint / kbd_korean.xml
Created September 24, 2013 16:27
XML from google korean keyboard
<?xml version="1.0" encoding="utf-8"?>
<Keyboard android:keyWidth="9.200001%" android:keyHeight="@dimen/key_height" android:horizontalGap="0.8000016%" android:verticalGap="@dimen/key_vertical_gap"
xmlns:android="http://schemas.android.com/apk/res/android">
<Row>
<Key android:horizontalGap="0.39999485%" android:codes="0x3142" android:popupKeyboard="@xml/kbd_popup_template" android:popupCharacters="1ㅃ" android:keyEdgeFlags="left" android:keyLabel="ㅂ" />
<Key android:codes="0x3148" android:popupKeyboard="@xml/kbd_popup_template" android:popupCharacters="2ㅉ" android:keyLabel="ㅈ" />
<Key android:codes="0x3137" android:popupKeyboard="@xml/kbd_popup_template" android:popupCharacters="3ㄸ" android:keyLabel="ㄷ" />
<Key android:codes="0x3131" android:popupKeyboard="@xml/kbd_popup_template" android:popupCharacters="4ㄲ" android:keyLabel="ㄱ" />
<Key android:codes="0x3145" android:popupKeyboard="@xml/kbd_popup_template" android:popupCharacters="5ㅆ" android:keyLabel="ㅅ" />
<peremen> 깻잎^cloud: TSP_로 시작하는 펌웨어는 mxt224E 수정 드라이버에서 불러올 거고요
<peremen> a225/a300은 Adreno 같아 보이고
<peremen> vics.* 이거는 퀄컴 비디오 인코딩 엔진이고
<peremen> es310_fw.bin 이거는 통화 오디오 앰프용 펌웨어임
//I will not use NULL terminated string for performance.
typedef struct charwithlen_struct {
char *data;
size_t len;
} charwithlen_t;
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#define CHUNK_SIZE 128
//I will not use NULL terminated string for performance.
@perillamint
perillamint / dumpcode.c
Created March 24, 2015 16:02
Ohhara's dumpcode - Linux kernel version.
#include <linux/kernel.h>
int isprintable(unsigned char c)
{
if(0x20 <= c && 0x7E >=c)
return 1;
return 0;
}
void printchar(unsigned char c)
@perillamint
perillamint / C_hacky_queue.c
Created March 26, 2015 16:44
Hacky OOP in C.
#include <stdio.h>
#include <stdlib.h>
//Some macro hack.
//new(constructor, object)
//delete(object)
#define new(x, o) o -> _constructor = x; o -> _constructor(o)
#define delete(x) x -> _destructor(x)
typedef struct queuenode_s {
@perillamint
perillamint / syscalltester.c
Created March 29, 2015 10:23
syscalltester.c
#include <unistd.h>
#include <stdio.h>
#if __x86_64__
#define __NR_my_enqueue 300
#define __NR_my_dequeue 301
#else // Assume X86_32
#define __NR_my_enqueue 338
#define __NR_my_dequeue 339
#endif
[ 0.000000] Initializing cgroup subsys cpuset
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Linux version 2.6.35.6-legolas+ (perillamint@Legolas) (gcc version 4.5.1 20100924 (Red Hat 4.5.1-4) (GCC) ) #6 SMP Tue Mar 24 00:09:49 KST 2015
[ 0.000000] Command line: ro root=/dev/mapper/vg_legolas-lv_root rd_LVM_LV=vg_legolas/lv_root rd_LVM_LV=vg_legolas/lv_swap rd_NO_LUKS rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYTABLE=us rhgb quiet
[ 0.000000] BIOS-provided physical RAM map:
[ 0.000000] BIOS-e820: 0000000000000000 - 000000000009fc00 (usable)
[ 0.000000] BIOS-e820: 000000000009fc00 - 00000000000a0000 (reserved)
[ 0.000000] BIOS-e820: 00000000000f0000 - 0000000000100000 (reserved)
[ 0.000000] BIOS-e820: 0000000000100000 - 000000003ffdf000 (usable)
[ 0.000000] BIOS-e820: 000000003ffdf000 - 0000000040000000 (reserved)