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
addEventListener('fetch', event => { | |
event.respondWith(handleRequest(event.request)) | |
}) | |
/** | |
* Respond to the request | |
* adapted from https://github.com/xiaoyang-liu-cs/workers-proxy | |
* @param {Request} request | |
*/ | |
async function handleRequest(request) { |
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
#!/bin/bash | |
set -o errexit | |
# Disclaimer: This is not the most secure configuration possible. This script | |
# is only intended to be more secure than the default configuration. No | |
# promises are made about this script preventing your server from getting | |
# owned or your bike getting stolen. The bad guys are still out to get you. | |
# And running this script does not excuse you from writing secure application | |
# code! |
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
# navigate to the project folder | |
# git pull latest version | |
# make sure user has permission to write in that folder | |
# install latest node | |
curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash - | |
sudo apt-get install -y nodejs | |
sudo npm install angular-cli -g | |
sudo npm install -g [email protected] # make sure its version 0.8.1 latest ones breaks |
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
find $basePath -name "$pattern" -print | zip -j "$outputFileName" -@ |
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
import java.io.{File} | |
import java.util.zip.{ZipEntry, ZipOutputStream} | |
val zipFilePath = "/tmp/allLogs.zip" | |
val zip = new ZipOutputStream(new FileOutputStream(zipFilePath)) | |
for (log <- logs) { | |
val link = file.link.get | |
val fileName = link.substring(link.lastIndexOf('/') + 1, link.lastIndexOf(".zip") + 4) // getting file name and removing the AWS params from the link | |
val source = scala.io.Source.fromURL(link, "ISO-8859-1") // this is because I am zipping binary files, if your encoding is different please pass likewise |
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
require 'oily_png' | |
require 'open-uri' | |
include ChunkyPNG::Color | |
def starts_with(item, prefix) | |
prefix = prefix.to_s | |
item[0, prefix.length] == prefix | |
end | |
# compares two images on disk, returns the % difference |
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
def select_date(date_string) | |
date = Date.parse(date_string) | |
query("view:'_UIDatePickerView'", [{:selectRow => date.month - 1}, {:inComponent => 0}, {:animated => 1}]) | |
query("view:'_UIDatePickerView'", [{:selectRow => date.day - 1}, {:inComponent => 1}, {:animated => 1}]) | |
query("view:'_UIDatePickerView'", [{:selectRow => date.year - 1}, {:inComponent => 2}, {:animated => 1}]) | |
sleep(0.4) | |
# the query does not create a UIControlEventValueChanged event, so we have to do a touch event | |
picker_scroll_up_on_column 0 | |
sleep(0.4) | |
picker_scroll_down_on_column 0 |
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
- (void)drawWithFrame:(NSRect)cellFrame | |
inView:(NSView *)controlView { | |
NSImage *img = [NSImage imageNamed:@"tf"]; | |
[img drawAtPoint:NSPointFromCGPoint(CGPointMake(0, 0)) | |
fromRect:NSZeroRect | |
operation:NSCompositeSourceOver | |
fraction:1]; | |
cellFrame.origin.x += 10; | |
cellFrame.origin.y += 16; |
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
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteCond %{HTTP_REFERER} ^.*(abacho|abizdirectory|about|acoon|alexana|allesklar|allpages|allthesites|alltheuk|alltheweb|altavista|america|amfibi|aol|apollo7|aport|arcor|ask|atsearch|baidu|bellnet|bestireland|bhanvad|bing|blog|bluewin|botw|brainysearch|bricabrac|browseireland|chapu|claymont|click4choice|clickey|clickz|clush|confex|cyber-content|daffodil|devaro|dmoz|dogpile|ebay|ehow|eniro|entireweb|euroseek|exalead|excite|express|facebook|fastbot|filesearch|findelio|findhow|finditireland|findloo|findwhat|finnalle|finnfirma|fireball|flemiro|flickr|freenet|friendsreunited|galaxy|gasta|gigablast|gimpsy|globalsearchdirectory|goo|google|goto|gulesider|hispavista|hotbot|hotfrog|icq|iesearch|ilse|infoseek|ireland-information|ixquick|jaan|jayde|jobrapido|kataweb|keyweb|kingdomseek|klammeraffe|km|kobala|kompass|kpnvandaag|kvasir|libero|limier|linkedin|live|liveinternet|lookle|lycos|mail|mamma|metabot|metacrawler|metaeureka|mojeek|msn|myspace|netscape|netzindex|nigma|nlsear |
NewerOlder