Skip to content

Instantly share code, notes, and snippets.

View if1live's full-sized avatar
💭
I may be slow to respond.

byunghoo.yu if1live

💭
I may be slow to respond.
View GitHub Profile
@if1live
if1live / sample.ts
Created November 8, 2018 03:34
indexedDBShim + dexie + typescript test
const setGlobalVars = require('indexeddbshim');
(global as any).window = global; // We'll allow ourselves to use `window.indexedDB` or `indexedDB` as a global
setGlobalVars(); // See signature below
(window.indexedDB as any).__setConfig({
checkOrigin: false,
});
const Dexie = require('dexie');
var db = new Dexie('friend_database');
db.version(1).stores({
//to use standard input/output
#include <iostream>
//to use ofstream
#include <fstream>
//to use thread class
#include <thread>
//to use mutex lock
#include <mutex>
//to use vector
#include <vector>
@if1live
if1live / localization.js
Last active March 23, 2018 05:48
json localication example
var type_a = {
"questions": [
{
"id": 1,
"order": 1,
"correct_answer": 1,
"question": {
"en": "[EN] 2017년 트위터에 140자였던 글자 제한이 어떻게 되었는가?",
"th": "[TH] 2017년 트위터에 140자였던 글자 제한이 어떻게 되었는가?"
},
@if1live
if1live / loop.cpp
Last active October 14, 2017 06:56
use stack address as loop ounter
#include <stdio.h>
void execute(int n, int total) {
printf("loop count : %d/%d\n", n, total);
}
int loop_core(int *root_addr, int *prev_addr, int num) {
int base_value = 0;
@if1live
if1live / touchpad-enable.sh
Created October 5, 2017 09:33
Enable/Disable/Toggle Touchpad (For Acer R11 Chromebook)
#!/bin/bash
LOG_FILE=/tmp/touchpad-enable-log
XINPUT_ID=`xinput list|grep Touchpad|awk '{print $5}'|cut --delimiter="=" -f 2`
function enable_touchpad() {
#/usr/bin/synclient TouchpadOff=0
xinput --enable $XINPUT_ID
echo "touchpad_enable\t:`date`" >> $LOG_FILE
}
@if1live
if1live / Twitter Cramming.user.js
Last active November 10, 2017 17:19 — forked from Prof9/Readme.md
Force enable cramming (280 character tweets) on Twitter. NOTE: Stops working when you switch pages, refresh to fix. https://twitter.com/Prof9/status/912859110776950784
// ==UserScript==
// @name Twitter Cramming
// @description Force enable cramming (280 character tweets) on Twitter
// @author Prof. 9
// @version 0.2
// @match https://twitter.com/*
// @run-at document-idle
// @namespace prof9.twittercramming
// ==/UserScript==
@if1live
if1live / EffectGizmo.cs
Created October 5, 2016 03:05
EffectGizmo
using UnityEngine;
namespace Assets.GameExternal.Scripts {
public class EffectGizmo : MonoBehaviour {
public enum Types {
Sphere,
DirectionX,
DirectionY,
DirectionZ,
}
@if1live
if1live / contradiction.pl
Last active May 31, 2016 14:35
맞는 말은 하나입니다. 그것을 골라주세요 - prolog version
/*
https://twitter.com/k2pa00/status/737300123332419585
execute
$ gprolog
['contradiction.pl'].
sol_a(A, B, C, D).
sol_b(A, B, C, D).
sol_c(A, B, C, D).
sol_d(A, B, C, D).
@if1live
if1live / use_after_delete.cpp
Created March 14, 2016 02:03
use after delete
#include <string>
#include <cstring>
class BrokenMemory {
public:
static BrokenMemory *Get();
public:
BrokenMemory() : data_("EPIC FAIL") {}
const char *data() const { return data_.data(); }
private:
@if1live
if1live / test_format_null.c
Created March 6, 2016 06:00
printf(%s) with null pointer
/*
printf(%s) with null pointer
## Execute
$ clang test_format_null.c && ./a.out
## Output
### OSX
|(null)||(nu|