Skip to content

Instantly share code, notes, and snippets.

View goyusia's full-sized avatar
๐Ÿ’ญ
I may be slow to respond.

byunghoo.yu goyusia

๐Ÿ’ญ
I may be slow to respond.
View GitHub Profile
@goyusia
goyusia / trigraphs.c
Created November 13, 2015 16:19
Alternative operator representations (C version)
/*
Reference
* http://en.cppreference.com/w/cpp/language/operator_alternative
$ clang trigraphs.c
*/
%:include <stdio.h>
%:include <stdbool.h>
%:include <iso646.h>
@goyusia
goyusia / A.java
Created November 21, 2015 01:42
A, A, A, A, A, ... with Java
/*
javac -g A.java && java A
*/
class A {
public A A() {
A A = new A();
return A;
}
public static void main(String[] args) {
@goyusia
goyusia / function_default_value_python.py
Last active November 24, 2015 02:27
function default value (Python vs Ruby)
#!/usr/bin/env python
'''
[haruna@haruna test ]$ ./function_default_value_python.py
2015-11-24 11:16:47.815578
2015-11-24 11:16:47.815578
same
'''
@goyusia
goyusia / Sheep.java
Created November 28, 2015 13:09
Sheep count with Garbage Collector
/*
How to run
$ javac Sheep.java && java Sheep -Xms1k -Xmx1k -XX:MaxPermSize=1k -XX:MaxNewSize=1k
Sample output
์–‘(id=35994) is created
์–‘(id=35995) is created
์–‘(id=35996) is created
์–‘(id=17679) is killed, current alive ์–‘ 14956๋งˆ๋ฆฌ
์–‘(id=35997) is created
@goyusia
goyusia / suicide.el
Last active December 2, 2015 04:59
Implementation "์‚ด์ž! == !์ž์‚ด", "์ž์‚ด! == !์‚ด์ž"
;; Implementation "์‚ด์ž! == !์ž์‚ด", "์ž์‚ด! == !์‚ด์ž"
;; How to run
;; emacs --script suicide.el
(defun fun-string-msg (word &optional func)
(if (eq nil func)
;; no argument
word
;; argument
word))
@goyusia
goyusia / main.c
Created December 15, 2015 08:01
fork with stdout buffer
// https://twitter.com/RhoP_nim/status/676667506052825090
#include "apue.h"
int glob = 6;
char buf[] = "a write to stdout\n";
void err_sys(const char *x, ...)
{
perror(x);
exit(1);
@goyusia
goyusia / calc_tk.py
Created December 17, 2015 09:28
calculate tk for translate-shell
#!/usr/bin/env python3
#-*- coding: utf-8 -*-
'''
$ ./calc_tk.py
text = ์•ˆ๋…•ํ•˜์„ธ์š” ํ…Œ์ŠคํŠธ์ž…๋‹ˆ๋‹ค
tk = 513628.127973
'''
text = u"์•ˆ๋…•ํ•˜์„ธ์š” ํ…Œ์ŠคํŠธ์ž…๋‹ˆ๋‹ค"
@goyusia
goyusia / waldo.el
Created December 20, 2015 15:08
Implementation ์™ˆ๋„์ฒด (emacs lisp version)
;; ์™ˆ๋„์ฒด ๊ตฌํ˜„์ฒด
;; ์•ˆ๋…•ํ•˜์‹ ๊ฐ€! ํž˜์„ธ๊ณ  ๊ฐ•ํ•œ ์•„์นจ, ๋งŒ์ผ ๋‚ด๊ฒŒ ๋ฌผ์–ด๋ณด๋ฉด ๋‚˜๋Š” ์™ˆ๋„.
;; execute & output
;; $ emacs --batch --script waldo.el
;; ์•ˆ๋…•ํ•˜์‹ ๊ฐ€!
;; ํž˜์„ธ๊ณ  ๊ฐ•ํ•œ ์•„์นจ
;;
;; (๋‚˜๋Š” ์™ˆ๋„)
@goyusia
goyusia / kick_bedclothes.el
Last active December 24, 2015 12:25
Implemention for ์ด๋ถˆํ‚ฅ
;; execute
;; emacs --batch --script kick_bedclothes.el
;; original: https://twitter.com/sucroseMass/status/680000098248470528
(defun ์ด๋ถˆํ‚ฅ (&optional x)
(message "์ฃฝ๊ณ  ์‹ถ๋‹ค"))
(์ด๋ถˆํ‚ฅ (์ด๋ถˆํ‚ฅ (์ด๋ถˆํ‚ฅ (์ด๋ถˆํ‚ฅ (์ด๋ถˆํ‚ฅ (์ด๋ถˆํ‚ฅ))))))
@goyusia
goyusia / maze_with_bug.hs
Created December 26, 2015 17:33
maze solver (haskell version. ์ œ๋Œ€๋กœ ์•ˆ๋Œ์•„๊ฐ)
-- ํ•˜์Šค์ผˆ์„ ์ด์šฉํ•ด ๋ฏธ๋กœ๋ฅผ ํ‘œํ˜„ํ•˜๋ผ.
-- Maze ์ž๋ฃŒํ˜•๊ณผ Node ์ž๋ฃŒํ˜•์ด ํ•„์š”ํ•  ๊ฒƒ์ด๋‹ค.
-- ์ฃผ์–ด์ง„ ์ขŒํ‘œ์— ๋”ฐ๋ผ ํ•˜๋‚˜์˜ ๋…ธ๋“œ๋ฅผ ๋ฆฌํ„ดํ•˜๋Š” ํ•จ์ˆ˜๋„ ํ•„์š”ํ•˜๋‹ค.
-- ๊ทธ๋ ‡๊ฒŒ ๋ฆฌํ„ด๋œ ๋…ธ๋“œ๋Š” ๋‹ค๋ฅธ ๋…ธ๋“œ๋กœ ๋„˜์–ด๊ฐˆ ์ˆ˜ ์žˆ๋Š” ์ถœ๊ตฌ์˜ ๋ฆฌ์ŠคํŠธ๋ฅผ ๋‹ด๊ณ  ์žˆ์–ด์•ผํ•œ๋‹ค.
-- ๋ฏธ๋กœ๋ฅผ ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•ด ๋ฆฌ์ŠคํŠธ ๋ชจ๋‚˜๋“œ๋ฅผ ์‚ฌ์šฉํ•˜๋ผ.
module Main where
data Maze t = Maze [[t]] deriving (Show)