💯 👍 👎 🔢 🎱
This file contains 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
(* functions *) | |
-- string replace function from http://www.macosxautomation.com/applescript/sbrt/sbrt-06.html | |
on replace_chars(this_text, search_string, replacement_string) | |
set AppleScript's text item delimiters to the search_string | |
set the item_list to every text item of this_text | |
set AppleScript's text item delimiters to the replacement_string | |
set this_text to the item_list as string | |
set AppleScript's text item delimiters to "" | |
return this_text |
This file contains 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
sox -t sw -r 44100 -c 2 /dev/zero -t coreaudio synth pinknoise vol -9 dB band -n 800 1200 fade q 5 30:00 10 |
This file contains 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
# convert MTS files to MOV for FCPX | |
ffmbc -i inFile -vcodec copy -strict experimental outFile |
This file contains 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/ruby | |
require 'shellwords' | |
query = ARGV.length > 0 ? ARGV.join(" ") : "date:today" | |
files = %x{mdfind '#{ARGV.join(" ")}'}.split("\n")[0..100] | |
filehash = {} | |
files.each {|file| | |
base = File.basename(file) |
This file contains 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
//this function composes functions like in Haskell (and most other functional languages) | |
//the final composed function can accept parameters dictated by the chain it creates | |
//you can pass it a list of functions and it shall apply them from RIGHT to LEFT (right associativeness?) | |
//eg., c0(fn1, fn2, fn3)(10) => return fn1(fn2(fn3(10))); | |
// out<---<----<----<=10 | |
function c0(f, g) { | |
var last; | |
if (!arguments.length) return; | |
if (arguments.length === 1) return f; | |
if (arguments.length === 2) { |
This file contains 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/ruby | |
if ARGV.size.zero? | |
puts %Q[ | |
Usage: | |
./to_csv.rb file.yml > out.csv | |
] | |
exit | |
end |
This is a sample script for retrieving the access token for Service Account using Google Apps Script. The flow for using this script is as follows.
- At first, please create the Service Account and retrieve JSON file.
- Put Scopes,
private_key
andclient_email
to the script. - Run the script.
var private_key = "#####"; // private_key of JSON file retrieved by creating Service Account
var client_email = "#####"; // client_email of JSON file retrieved by creating Service Account
This file contains 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
function generateAlphabets() { | |
var alphabets = []; | |
var start = 'A'.charCodeAt(0); | |
var last = 'Z'.charCodeAt(0); | |
for (var i = start; i <= last; ++i) { | |
alphabets.push(String.fromCharCode(i)); | |
} | |
return alphabets.join(''); | |
} |
This file contains 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
Copyright (c) 2012 Yu-Jie Lin | |
Permission is hereby granted, free of charge, to any person obtaining a copy of | |
this software and associated documentation files (the "Software"), to deal in | |
the Software without restriction, including without limitation the rights to | |
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies | |
of the Software, and to permit persons to whom the Software is furnished to do | |
so, subject to the following conditions: | |
The above copyright notice and this permission notice shall be included in all |
OlderNewer