This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#include <memory> | |
class Year { | |
public: | |
~Year() { | |
printf("Happy New Year!\n"); | |
} | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
#-*- coding: utf-8 -*- | |
def left_shift(n): | |
return n + n | |
def is_bit_on(n, bit): | |
a = n % bit | |
b = n % left_shift(bit) | |
if not b: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <type_traits> | |
class Foo; | |
class Bar; | |
class API { | |
public: | |
template<typename T> | |
void call(const T &obj) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
#-*- coding: utf-8 -*- | |
from evdev import UInput, ecodes as e | |
from asyncore import file_dispatcher, loop | |
from evdev import InputDevice, categorize, ecodes | |
from select import select | |
dev = InputDevice('/dev/input/event4') | |
print(dev) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
http://en.wikipedia.org/wiki/C_Sharp_syntax#Closure_blocks | |
C# | |
public void Foo() | |
{ | |
using (var bar = File.Open("Foo.txt")) | |
{ | |
// do some work | |
throw new Exception(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -z "$1" ] || [ "1" == "$1" ]; then | |
echo 1 | |
else | |
next=$(( $1 - 1 )) | |
prev=$(./factorial.sh $next) | |
echo $(( $prev * $1 )) | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* https://twitter.com/Code_60/status/577062012250796032 | |
* μ€λμ μ£Όμ λ "13μΌμ κΈμμΌ" μ λλ€. | |
* Input : λ μ | |
* Output : ν΄λΉ λ λμ 13μΌμ κΈμμΌμ΄ ν¬ν¨λ μ | |
* ex) input : 2015 output : 3 | |
*/ | |
#include <cstdio> | |
#include <vector> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://twitter.com/Code_60/status/579601136300101632 | |
# 15/03/22 | |
# μ΄λ² μ£Όμ λ "νμκ³"μ λλ€. μ΄λ€ νλ‘κ·Έλ¨μ΄λ μκ΄μμ΅λλ€. | |
# νμκ³μ κ΄λ ¨λ νλ‘κ·Έλ¨μ μμ±ν΄ μ£Όμλ©΄ λκ² μ΅λλ€. | |
# μ΄λ² λ―Έμ μ "λλ ν"μ λλ€. μ΅λν μ½κΈ° νλ€κ³ , κΈ΄ μ½λκ° λ―Έμ μ΄ λκ² μ΅λλ€. κ·ΈλΌ, μμ! | |
# | |
# νμ§λ§ λ λλ νμ κ΄μ¬ μμ΄μ λͺ μμ±μ κΉ λ€. | |
solar_system = [:sun, :mercury, :venus, :earth, :mars, :jupiter, :saturn, :uranus, :neptune] | |
Solar,System,Contains,Fixed,Star,And,Some,Planets,ANd,Pluto = solar_system | |
puts "Pluto : #{Pluto}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
#-*- coding: utf-8 -*- | |
''' | |
output sample | |
initial create : 0.0293490886688 | |
re-create #1 : 0.00163388252258 | |
re-create #2 : 0.00191903114319 | |
μ΅μ΄ μμ±μμλ§ λ리λ€. | |
''' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
type listλ₯Ό μ°Έμ‘°ν΄μ λ§λ int listμ car, cdr | |
reference : http://coliru.stacked-crooked.com/a/0af9789bed2adaf7 | |
*/ | |
#include <type_traits> | |
#include <climits> | |
template<int... Items> | |
struct intlist; |
OlderNewer