Skip to content

Instantly share code, notes, and snippets.

View soundlake's full-sized avatar

Sinyeol An soundlake

View GitHub Profile
#include <alsa/asoundlib.h>
#include <stdio.h>
#define PCM_DEVICE "hw:0,0"
int main(int argc, char **argv) {
unsigned int pcm, tmp, dir;
int rate, channels, seconds;
snd_pcm_t *pcm_handle;
snd_pcm_hw_params_t *params;
@soundlake
soundlake / euler_method.py
Created January 8, 2015 22:26
Calculate log 3 base 2 using Euler Method.
import math
step = 0.1
########## calculate log(2)
'''
log(1.1) ~= log(1.0) + log'(1.05) * 0.1
log(1.2) ~= log(1.1) + log'(1.15) * 0.1
...
@soundlake
soundlake / 1st_approach.py
Created July 4, 2015 12:42
to print out prime numbers below certain integer.
number = int(input('input a number: '))
for candidate in range(2, number + 1):
is_candidate_a_prime = True
for i in range(2, candidate):
if candidate % i == 0:
is_candidate_a_prime = False
break
if is_candidate_a_prime:
print(candidate)
@soundlake
soundlake / spot_difference.pde
Last active January 21, 2017 23:25
simple frame for spot difference game in Processing
/*
* 전역변수를 설정하기
*/
boolean is_test = true;
boolean is_display_answer = false;
if (is_test) {
int[][] coordinates = new int[5][2];
}
else {
int[][] coordinates = {
@soundlake
soundlake / object_to_ul_with_jQeury.js
Created February 20, 2017 10:41
Using jQuery, convert plain JS object to un-ordered list
function object_to_ul(o) {
var $ul = $('<ul/>');
for (var k in o) {
var $li = $('<li/>').text(k);
if (o[k] !== null && typeof(o[k]) == 'object')
$li.append(object_to_ul(o[k]));
$ul.append($li);
}
return $ul;
}
@soundlake
soundlake / redirect_by_device.html
Last active June 7, 2017 10:29
redirect page depending on the device
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<script>
// Minified version of [isMobile](https://github.com/kaimallea/isMobile)
!function(a){var b=/iPhone/i,c=/iPod/i,d=/iPad/i,e=/(?=.*\bAndroid\b)(?=.*\bMobile\b)/i,f=/Android/i,g=/(?=.*\bAndroid\b)(?=.*\bSD4930UR\b)/i,h=/(?=.*\bAndroid\b)(?=.*\b(?:KFOT|KFTT|KFJWI|KFJWA|KFSOWI|KFTHWI|KFTHWA|KFAPWI|KFAPWA|KFARWI|KFASWI|KFSAWI|KFSAWA)\b)/i,i=/IEMobile/i,j=/(?=.*\bWindows\b)(?=.*\bARM\b)/i,k=/BlackBerry/i,l=/BB10/i,m=/Opera Mini/i,n=/(CriOS|Chrome)(?=.*\bMobile\b)/i,o=/(?=.*\bFirefox\b)(?=.*\bMobile\b)/i,p=new RegExp("(?:Nexus 7|BNTV250|Kindle Fire|Silk|GT-P1000)","i"),q=function(a,b){return a.test(b)},r=function(a){var r=a||navigator.userAgent,s=r.split("[FBAN");return"undefined"!=typeof s[1]&&(r=s[0]),s=r.split("Twitter"),"undefined"!=typeof s[1]&&(r=s[0]),this.apple={phone:q(b,r),ipod:q(c,r),tablet:!q(b,r)&&q(d,r),device:q(b,r)||q(c,r)||q(d,r)},this.amazon={phone:q(g,r),tablet:!q(g,r)&&q(h,r),device:q(g,r)||q(h,r)},this.
@soundlake
soundlake / install_remarkable2_kr_font.md
Last active August 20, 2023 19:55
리마커블2에 한국어 폰트 적용하기