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 is a quick and dirty script for copying files in AWS S3 to other buckets. | |
* This is written so it can work across AWS accounts. | |
* You can hack in code to apply work or logic to each file. | |
* | |
* For each file, it downloads locally to a tmp file and then starts uploading as soon as possible | |
* and deletes the file immediately when the upload is done. | |
* | |
* Best way to use: Spin up a micro in EC2, install node.js, | |
* create a directory and install the dependencies with |
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
class Base64 { | |
private PADCHAR: string = '='; | |
private ALPHA: string = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; | |
private getByte(s: string, i: number): number { | |
const x = s.charCodeAt(i); | |
return x; | |
} | |
private getByte64(s: string, i: number): number { |
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
defaults write com.apple.screencapture disable-shadow -bool true | |
killall SystemUIServer |
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
HOST=http://name:password@127.0.0.1:5984 # or whatever you got | |
curl -X PUT $HOST/_config/httpd/enable_cors -d '"true"' | |
curl -X PUT $HOST/_config/cors/origins -d '"*"' | |
curl -X PUT $HOST/_config/cors/credentials -d '"true"' | |
curl -X PUT $HOST/_config/cors/methods -d '"GET, PUT, POST, HEAD, DELETE"' | |
curl -X PUT $HOST/_config/cors/headers -d '"accept, authorization, content-type, origin, referer, x-csrf-token"' |
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
// Safari, in Private Browsing Mode, looks like it supports localStorage but all calls to setItem | |
// throw QuotaExceededError. We're going to detect this and just silently drop any calls to setItem | |
// to avoid the entire page breaking, without having to do a check at each usage of Storage. | |
(function(){ | |
if (typeof localStorage === 'object') { | |
try { | |
localStorage.setItem('localStorage', 1); | |
localStorage.removeItem('localStorage'); | |
} catch (e) { | |
Storage.prototype._setItem = Storage.prototype.setItem; |
NewerOlder