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
| // Run this in the F12 javascript console in chrome | |
| // if a redirect happens, the page will pause | |
| // this helps because chrome's network tab's | |
| // "preserve log" seems to technically preserve the log | |
| // but you can't actually LOOK at it... | |
| // also the "replay xhr" feature does not work after reload | |
| // even if you "preserve log". | |
| window.addEventListener("beforeunload", function() { debugger; }, false) |
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
| //Now with less jquery | |
| //1) go to your my-list page, and scroll to the bottom to make sure it's all loaded: | |
| //http://www.netflix.com/browse/my-list | |
| //2) Next, paste this in your developer tools console and hit enter: | |
| [...document.querySelectorAll('.slider [aria-label]')].map(ele => ele.getAttribute('aria-label')) | |
| //or use this to copy the list to your clipboard: | |
| copy([...document.querySelectorAll('.slider [aria-label]')].map(ele => ele.getAttribute('aria-label'))) |
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
| SELECT * FROM table | |
| WHERE _ROWID_ >= (abs(random()) % (SELECT max(_ROWID_) FROM table)) | |
| LIMIT 1 |
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
| ifeq ($(strip $(shell git status --porcelain 2>/dev/null)),) | |
| GIT_TREE_STATE=clean | |
| else | |
| GIT_TREE_STATE=dirty | |
| endif | |
| all: build | |
| build: | |
| @echo "==> Building the project" |
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
| /* MIT License | |
| * | |
| * Copyright (c) 2017 Roland Singer [roland.singer@desertbit.com] | |
| * | |
| * 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: |
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
| // RateLimit middleware limits the throughput to h using TickerLimiter | |
| // configured with the provided rps and burst. The request will idle | |
| // for the passed in wait before cancelling if there is a queue. | |
| func RateLimit(rps, burst int, wait time.Duration, h http.HandlerFunc) http.HandlerFunc { | |
| l, _ := TickerLimiter(rps, burst) | |
| return func(w http.ResponseWriter, r *http.Request) { | |
| t := time.NewTimer(wait) | |
| select { | |
| case <-l: |
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
| #! /bin/bash | |
| set -euo pipefail | |
| # This script will remove automatic association for all networks not listed in the whitelist | |
| # passed as the first argument. Passwords will NOT be removed from the Keychain. | |
| # | |
| # Alternatively, you can untick "Remember networks" in Network Preferences > Wi-Fi > Advanced, | |
| # but then you won't be able to auto-join networks even temporarily, and you might already | |
| # have a long list to go through. | |
| # |
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
| // Usage: | |
| /* | |
| if let aStreamReader = StreamReader(path: "/path/to/file") { | |
| defer { | |
| aStreamReader.close() | |
| } | |
| while let line = aStreamReader.nextLine() { | |
| print(line) | |
| } | |
| } |
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
| #!/bin/sh | |
| eval `go build -work -a 2>&1` && find $WORK -type f -name "*.a" | xargs -I{} du -hxs "{}" | gsort -rh | sed -e s:${WORK}/::g |
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
| // Swift's untyped errors are a goddam PiTA. Here's the pattern I use to try to work around this. | |
| // The goal is basically to try to guarantee that every throwing function in the app throws an | |
| // ApplicationError instead of some unknown error type. We can't actually enforce this statically | |
| // But by following this convention we can simplify error handling | |
| enum ApplicationError: Error, CustomStringConvertible { | |
| // These are application-specific errors that may need special treatment | |
| case specificError1 | |
| case specificError2(SomeType) |