Skip to content

Instantly share code, notes, and snippets.

View 123jimin's full-sized avatar
🏠
Working from home

Jimin Park 123jimin

🏠
Working from home
View GitHub Profile
@123jimin
123jimin / AutoPoke.js
Created May 14, 2013 15:21
AutoPoke.js
String.prototype.pad = function(i){
var s = this;
while(s.length<i) s="0"+s;
return s;
}
Date.prototype.format = function(s){
s = s.replace(/Y/g,this.getFullYear());
s = s.replace(/M/g,(this.getMonth()+1).toString().pad(2));
s = s.replace(/d/g,this.getDate().toString().pad(2));
@123jimin
123jimin / trash.js
Last active December 16, 2015 10:29
I have committed a lot of terrible mistakes involving rm, so I coded this script to prevent any further accidents.
#!/usr/bin/env node
var fs = require('fs');
var help = "Usage : trash [-lhx] files...\n\t-l : list trashcan\n\t-x : cancel (files: timestamp)\n\t-h : help";
var trash = process.env['HOME'] + "/.trash/";
(function(argv, log, error) {
argv = require('optimist').parse(argv);
if (typeof argv.l === 'string') {
@123jimin
123jimin / CPUem.cs
Created April 9, 2013 09:23
I spot a serious bug here
case (int)instructions.Div://divides regB with regC and puts the result in regA
if (register[regB] == 0)
return -1;
register[regA] = register[regB] / register[regC];
executionTime += 39;
break;
@123jimin
123jimin / SeedGenerator.java
Created March 28, 2013 09:43
Enter a 6-byte string, then this will emit a Java program printing the string.
import java.util.Random;
import java.util.Scanner;
public class SeedGenerator {
public static void main(String[] args) throws Exception{
Scanner scanner = new Scanner(System.in);
System.out.print("Write a 6-byte string: ");
String string = scanner.next();
byte[] b = string.getBytes("UTF-8");
@123jimin
123jimin / X.java
Created March 27, 2013 16:46
"Hello, world!" in Java
import java.util.Random;
class X {
public static void main(String[] s) {
byte[] a = new byte[6], b = new byte[6];
new Random(0x437950CAAB99L).nextBytes(a);
new Random(0xD6FD03B08D76L).nextBytes(b);
System.out.println(new String(a) + " " + new String(b));
}
}
@123jimin
123jimin / X.java
Created March 27, 2013 16:21
An example shows that a seed can encode a 6-byte long string.
import java.util.Random;
public class X{
static{
byte[] b = new byte[6];
new Random(0xFE7147F36BBFL).nextBytes(b);
System.out.println(new String(b));
}
}
@123jimin
123jimin / yfr.js
Created December 3, 2015 10:12
Embedded Youtube videos to iframe-based Youtube videos
// ==UserScript==
// @name YouTube Flash Player Replacer
// @namespace http://0xF.kr/script/
// @version 0.1
// @description try to take over the world!
// @author JiminP
// @match https://namu.wiki/w/*
// @grant none
// ==/UserScript==
/* jshint -W097 */
@123jimin
123jimin / jmap.js
Created September 10, 2015 04:39
Simple Jubeat Fumen Parser
(function(window){
var JMap = function JubeatMap(o, print_min){
var music_title = o.m.title ? o.m.title :
o.s.m ? o.s.m.split('/').pop().split('.')[0] :
o.s.bga ? o.s.bga : "";
this.metadata = {
'music': o.s.m || null, 'bga': o.s.bga || null,
'title': music_title, 'level': o.m.level || 10,
'difficulty': o.m.dif || 3, 'artist': o.m.artist || null,
'jacket': o.m.jacket || null
@123jimin
123jimin / 99.bf
Created March 17, 2015 16:57
99 bottles of beer made with BFMacro
[-]+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>[-]+++++++++>[-]+++++++++>[-]+++++++++++++++++++++++++++++++++++++++++++++++++++++++++>[-]+++++++++++++++++++++++++++++++++++++++++++++++++++++++++>[-]+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++<<<<<<[>>>>>>>[-]<<<<<[>>>>>+>+<<<<<<-]>>>>>>[<<<<<<+>>>>>>-]<[<<<.>>>[-]]<<.>>>>[-]++++++++++++++++++++++++++++++++.++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.+++++++++++++.+++++.[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.--------.-------.<<[-]<[>+>+<<-]>>[<<+>>-]<[<.>[-]]>>[-]++++++++++++++++++++++++++++++++.+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.---------.--------------------------------------------------
@123jimin
123jimin / homework.sty
Created September 16, 2014 07:40
My Homework Template
%% Style for homework
\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesPackage{homework}
\RequirePackage{fancyhdr,enumerate}
\RequirePackage[margin=1in]{geometry}
\RequirePackage{amsmath,amsthm,amssymb,tikz}
\usetikzlibrary{calc,trees,positioning,arrows,fit,shapes}