Skip to content

Instantly share code, notes, and snippets.

View unforswearing's full-sized avatar

Alvin Charity unforswearing

View GitHub Profile
@pipwerks
pipwerks / Convert "localhost" address to your Mac's current IP address
Last active August 29, 2015 13:57
AppleScript for converting "localhost" address to your Mac's current IP address. This enables testing in VMs (they can't resolve localhost but *can* resolve the local IP). This also enables your coworkers to view pages being served from your Mac. Read more at http://pipwerks.com/2014/03/08/convert-localhost-to-your-macs-current-ip-address/
(* 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
@patrickmcguire
patrickmcguire / gist:6142069
Created August 2, 2013 18:12
pink noise on os x
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
# convert MTS files to MOV for FCPX
ffmbc -i inFile -vcodec copy -strict experimental outFile
@ttscoff
ttscoff / spl.rb
Created May 2, 2014 14:46
A Sentaku-based wrapper for mdfind
#!/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)
@jcouyang
jcouyang / all github 887 emojis.md
Last active February 5, 2018 08:05
all github 887 emoji

💯 👍 👎 🔢 🎱 🅰️ 🆎 🔤 🔡 🉑 🚡 ✈️ ⏰ 👽 🚑 ⚓ 👼 💢 😠 😧 🐜 🍎 ♒ ♈ ◀️ ⏬ ⏫ ⬇️ 🔽 ▶️ ⤵️ ⤴️ ⬅️ ↙️ ↘️ ➡️ ↪️ ⬆️ ↕️ 🔼 ↖️ ↗️ 🔃 🔄 🎨 🚛 😲 👟 🏧 🅱️ 👶 🍼 🐤 🚼 🔙 🛄 🎈 ☑️ 🎍 🍌 ‼️ 🏦 📊 💈 ⚾ 🏀 🛀 🛁 🔋 🐻 🐝 🍺 🍻 🪲 🔰 🔔 🍱 🚴 🚲 👙 🐦 🎂 ⚫ 🃏 ⬛ ◾ :

@zeusdeux
zeusdeux / compose.js
Last active December 25, 2019 04:04
Functional programming toolkit for javascript
//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) {
@amir20
amir20 / to_csv.rb
Created March 15, 2012 01:10
Converts YAML to CSV
#!/usr/bin/ruby
if ARGV.size.zero?
puts %Q[
Usage:
./to_csv.rb file.yml > out.csv
]
exit
end
@tanaikech
tanaikech / readme.md
Created December 7, 2018 03:15
Retrieving Access Token for Service Account using Google Apps Script

Retrieving Access Token for Service Account using Google Apps Script

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.

  1. At first, please create the Service Account and retrieve JSON file.
  2. Put Scopes, private_key and client_email to the script.
  3. 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
@mreigen
mreigen / generate-alphabets.js
Created November 20, 2017 05:55
Javascript generate alphabet string
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('');
}
@livibetter
livibetter / COPYING
Created March 8, 2012 01:51
Soundex in Bash
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