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 bash | |
| # display battery percentage, and AC/DC status via ~[AC] _[DC], C(harging) F(ull) D(ischarging) | |
| # Works - on Lenovo Thinkpad | |
| set -u | |
| # or call | |
| # upower -d | |
| # detail text info |
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 bash | |
| set -u # stop unset | |
| set -e # stop error | |
| target_db=-18 | |
| volume_range=3 # db | |
| output_sr=48000 # match with input SR | |
| #output_sr=24000 # some speech synths | |
| output_folder="../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
| shell ${SHELL} | |
| startup_message off | |
| termcapinfo xterm* ti@:te@ | |
| defscrollback 10000 # default: 100 |
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 julia | |
| # Julia 0.6 syntax | |
| v = Float64.(1:10) # "Julia vector | |
| p = pointer(v) # 'raw' c-like pointer to data | |
| v1 = unsafe_wrap(Matrix{Float64}, p, (10,1), false) # get vector 'back' | |
| m1 = unsafe_wrap(Matrix{Float64}, p, (2,5), false) # as Matrix | |
| m2 = unsafe_wrap(Matrix{Float64}, p, (5,2), false) # another 'reshape()' |
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 julia | |
| # Poor-man's "spaced-repetition" playlist creator | |
| # for audio playlists from http://fieldsupport.dliflc.edu :: | |
| # "language survival kits" | |
| # Julia 0.6 script: | |
| if length(ARGS) < 1 | |
| error("missing Language arg, for example: 'tigrinya'") |
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
| # see: https://stackoverflow.com/questions/39493808/macros-and-string-interpolation-julia | |
| macro e_str(s) | |
| esc(parse("\"$(escape_string(s))\"")) | |
| end | |
| # for example : |
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
| """create a Dict{Symbol,Any} capturing variables | |
| Example: | |
| ``` | |
| a=1 ; b=11 | |
| d = @capture_dict(a,b) | |
| > Dict{Symbol,Int64} with 2 entries: | |
| > :a => 1 , :b => 11 | |
| ``` | |
| """ | |
| macro capture_dict(variables...) |
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
| 'use strict' | |
| ///// | |
| let child_process = require('child_process') | |
| // execSync: from stackoverflow advice: | |
| // https://stackoverflow.com/questions/32874316/node-js-accessing-the-exit-code-and-stderr-of-a-system-command | |
| function systemSync(cmd) { | |
| console.log("exec: ", cmd) | |
| try { |
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
| # Julia 0.6 syntax: | |
| # create a dictionary with 'Symbol' keys instead of 'String' keys | |
| # sometimes after serializing from a JSON: | |
| module Misc | |
| f_helper(x) = x | |
| f_helper(d::Dict) = Dict(Symbol(k) => f_helper(v) for (k, v) in d) | |
| symbol_dict(d::Dict) = f_helper(d) |
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> | |
| template<typename T> | |
| bool is_same_type(T a,T b) { | |
| return true; | |
| } | |
| template<typename T, typename S> | |
| bool is_same_type(T a,S b) { | |
| return false; |
NewerOlder