Skip to content

Instantly share code, notes, and snippets.

View leo424y's full-sized avatar

Fly Chang leo424y

View GitHub Profile
@leo424y
leo424y / c.rb
Created November 26, 2016 07:58
cut 1 md to many jekll posts
# 此檔案可以將一文字檔單檔切成 Github Page 用的 Markdown 檔案,可方便直推Github BLOG 詳 https://jekyllrb.com/
# v1.0.1105
# TODO 重構,通用化,對不起它很髒XD
# TODO 檔名不要有數字
# 將此檔另存後執行 $ ruby spliter.rb 即將同資料夾內的 "-2016-11-05-.md" 切出下面格式檔案
# -2016-11-05-.md
# 事實
# 就是一切發生的事,眾人認同的事
# xxx
# 情感
@leo424y
leo424y / thunk-middleware.md
Created December 5, 2016 12:29
thunk middleware

thunk MIDDLEWARE 好棒棒


thunk MIDDLEWARE 目的

處理非同步 fucntion 如各種 API

@leo424y
leo424y / thunk-middleware.md
Created December 5, 2016 12:30
thunk middleware 1205

thunk MIDDLEWARE 好棒棒


thunk MIDDLEWARE 目的

處理非同步 fucntion 如各種 API

Effective Engineer - Notes

What's an Effective Engineer?

  • They are the people who get things done. Effective Engineers produce results.

Adopt the Right Mindsets

@leo424y
leo424y / gist:c640477df744f578ef21355d2ae8c384
Created February 7, 2018 01:59
mac下跑聲學0207結果
TIME_H=1 -DHAVE_ASSERT_H=1 -DHAVE_FLOAT_H=1 -DHAVE_LIMITS_H=1 -I. -g -Os scorer.cpp
gcc -c -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DHAVE_LIBM=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_UNISTD_H=1 -DHAVE_STRING_H=1 -DHAVE_STDIO_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MATH_H=1 -DHAVE_TIME_H=1 -DHAVE_ASSERT_H=1 -DHAVE_FLOAT_H=1 -DHAVE_LIMITS_H=1 -I. -g -Os stm_inputparser.cpp
gcc -c -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DHAVE_LIBM=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_UNISTD_H=1 -DHAVE_STRING_H=1 -DHAVE_STDIO_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MATH_H=1 -D
@leo424y
leo424y / gitlfsserver.sh
Last active February 14, 2018 01:09 — forked from voidtuxic/gitlfsserver.sh
Git LFS server config
#!/bin/sh
### BEGIN INIT INFO
# Provides: gitlfsserver
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start daemon at boot time
# Description: Enable service provided by daemon.
### END INIT INFO
@leo424y
leo424y / sonic_pi_examples.txt
Created February 15, 2018 08:35 — forked from darinwilson/sonic_pi_examples.txt
Sonic Pi Examples
##############################################
## Example 1 - play a note
play 60
##############################################
## Example 2 - play 4 random notes
4.times do
play rrand_i(60, 90)
sleep 0.5
@leo424y
leo424y / README.md
Created February 15, 2018 08:36 — forked from xavriley/README.md
Original NES Mario Theme for Sonic Pi

Making Chiptune Music using Sonic Pi v2.0

Warning: this might not work on a RaspberryPi yet

I was curious about making retro gaming sounds using Sonic Pi. A couple of months and a lot of Googling later, here's the original Mario Bros theme as it was heard on the NES console.

I'm (just about) old enough to remember rushing home from school to play this game at Philip Boucher's house, sitting cross-legged in front of the TV till my feet got pins and needles. Working out how to recreate it for Sonic Pi was a lot of fun!

Getting the sounds of the NES chip

live_loop :fireworks do
synth :gnoise,
amp: rrand(0.1, 1.5),
attack: rrand(0.01, 0.03),
cutoff: rrand(100, 130),
pan: rrand(-1, 1)
sleep rrand(0.01, 0.05)
end
#Tomtom rhythms found on wikipedia https://en.wikipedia.org/wiki/Rhythm_in_Sub-Saharan_Africa#/media/File:Standard_pattern,_six_beats.png
#form the basis of this piece coded for Sonic PI by Robin Newman, December 2017
l1=(ring 1,0,1,0,1,0,1,0,1,0,1,0)
l2=(ring 0,1,0,1,0,1,0,1,0,1,0,1)
l3=(ring 0,1,0,0,1,1,0,1,0,1,0,1)
l4=(ring 1,0,1,0,1,1,0,1,0,1,0,1)
l=(ring l1,l2,l3,l4)
set :kill,0 #initialise kill flag