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
def cidr_range(cidr): | |
ip, subnet = cidr.split('/') | |
ipint = ip2int(ip) | |
subnet = int(subnet) | |
mask = ''.join(['1' for num in range(subnet)] + ['0' for num in range(32 - subnet)]) | |
inverted_mask = ''.join(['0' for num in range(subnet)] + ['1' for num in range(32 - subnet)]) | |
mask_int = int(mask, 2) |
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
import argparse, boto | |
AWS_ACCESS_KEY = '' | |
AWS_SECRET_KEY = '' | |
AWS_CLOUDFRONT_ID = "" | |
def invalidate (f, print_debug=False): | |
from boto.cloudfront import CloudFrontConnection | |
con = CloudFrontConnection(AWS_ACCESS_KEY, AWS_SECRET_KEY) |
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
server { | |
root /www/site/; | |
server_name site.com *.site.com; | |
location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ { | |
access_log off; | |
log_not_found off; | |
expires 360d; | |
} |
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
$ x11vnc -rfbport 1111 -display :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
#!/bin/sh | |
# Current as working as of 2012/4/17 | |
# Xcode 4.3.2 | |
PROJECT_ROOT="$HOME/SomeDirWhereYourProjectLives/XXXXXXXX" | |
WORKSPACE="$PROJECT_ROOT/XXXXXXXX.xcodeproj/project.xcworkspace" | |
CONFIG="AdHoc" | |
SCHEME="XXXXXXXX" |
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
i could suggest you do this: | |
user 1: | |
id: 5 | |
name: angelo | |
email: [email protected] | |
key/value: | |
['date subscribed', 02/17/2010], | |
['birthday', 02/17/1990] |
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
<?php | |
// simple lock, prevent script from running multiple times at once | |
$lockfile = '/tmp/.run.php-lock-' . md5(implode('', array_slice($argv, 1))); | |
if (($lock = fopen($lockfile, 'w+')) === false) { | |
echo "fopen($lockfile) failed\n"; | |
die(-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
// filter out stupid error messags | |
(function () { | |
const prev = window.addEventListener; | |
const ignore = ['__gCrWeb.autofill.']; | |
window.addEventListener = function (a, b, c) { | |
if (a === 'error') { | |
return prev(a, function (err) { | |
// if error is matched to ignore list, ignore it then | |
if (err && err.message && ignore.filter(t => err.message.indexOf(t) > -1).length) { |
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 | |
# ref https://gist.githubusercontent.com/robsonsobral/a9071e56cc495763d727/raw/0763e9b0c627c5ab6e0281e604cdb4af40c2be62/cloudflare-update-ip-ranges.sh | |
# | |
# | |
# Location of the nginx config file that contains the CloudFlare IP addresses. | |
CF_NGINX_CONFIG="/etc/nginx/cloudflare" | |
# The URLs with the actual IP addresses used by CloudFlare. | |
CF_URL_IP4="https://www.cloudflare.com/ips-v4" | |
CF_URL_IP6="https://www.cloudflare.com/ips-v6" |
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
[Unit] | |
Description=pdr worker serivice @ %I | |
After=network.target | |
[Service] | |
Type=simple | |
User=www-data | |
ExecStart=/usr/bin/php /app/live/bin/run-worker | |
ExecReload=/bin/kill -HUP $MAINPID |