Skip to content

Instantly share code, notes, and snippets.

View PatrickRoumanoff's full-sized avatar

Patrick Roumanoff PatrickRoumanoff

View GitHub Profile
/// A calculation that holds a left term, a right term, and an operation
struct Calc<T> {
var lt: () -> T
var op: (T, T) -> T
var rt: () -> T
init(lt: () -> T, op: (T, T) -> T, rt: () -> T) {
self.lt = lt
self.op = op
self.rt = rt
@sofakartoffel
sofakartoffel / gist:5175899
Last active December 15, 2015 00:49
OSX seems to set 802.11d country code upon the first found network's country code. This might not be the correct one, depending on your or your neighbors' settings. This script restarts your Wi-Fi until (or 10 times) the correct country code is set.
-- This does not work if you need administrator privilieges for setting Wi-Fi power
set correctcountrycode to "DE"
repeat 10 times
set countrycode to do shell script "system_profiler SPAirPortDataType -xml | xmllint --dropdtd - | xpath '//key[text()=\"spairport_wireless_country_code\"]/following-sibling::string[1]/text()'"
if countrycode = correctcountrycode then exit repeat
do shell script "networksetup -setairportpower en1 off"
delay 6
do shell script "networksetup -setairportpower en1 on"
delay 2
end repeat
@idan
idan / gist:3135754
Created July 18, 2012 11:50
A Sample Post

Hello there! This is a sample post for gist.io, a super-lightweight writing soapbox for hackers.

Now look up. Further. Above the post title. See that grey text with the gist ID?

Now back to me. That grey text is a link! Open that sucker in a new tab to see the source for this post. Also, I'm on a horse.

This is a major heading

If you peek at it with a web inspector, you'll see that it is a second-level heading. You can use first level headings, but they'll look just like the second level ones, and the gods of the HTML5 outlining algorithm will frown upon you.