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
# | |
# Blocks list of IP addresses using macOS/BSD PF firewall. | |
# | |
# Enable: sudo pfctl -ef ./pf_block.conf | |
# | |
# Disable: sudo pfctl -d (completely disable firewall) | |
# sudo pfctl -f /etc/pf.conf (reset rules) | |
# | |
blocked_ips = "{ \ |
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
#include <sys/time.h> | |
#include <sys/resource.h> | |
#include <sys/types.h> | |
#include <stdio.h> | |
#include <string.h> | |
int main(int argc, char **argv) { | |
if (argc < 2) { | |
fprintf(stderr, "usage: %s [pid]", argv[0]); | |
return 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
#!/usr/bin/env python | |
from __future__ import absolute_import, print_function, unicode_literals, division | |
import re | |
import logging | |
import threading | |
import time | |
import watchdog.events | |
import watchdog.observers |
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 | |
set -e | |
openssl genpkey -algorithm RSA -out private.pem -pkeyopt rsa_keygen_bits:4096 | |
openssl rsa -pubout -in private.pem -out public.pem |
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
from PIL import ImageChops, ImageDraw | |
def create_diff_image(img1, img2): | |
""" | |
Compares two Images and either creates an Image with differences | |
outlined with red bounding boxes, or returns None if no differences | |
were found. | |
""" | |
diff_img = img2.copy() |
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 | |
header('Content-Type: text/plain'); | |
// y combinator | |
function y($F) { | |
$x = function ($f) use ($F) { | |
return $F(function () use ($f) { | |
return call_user_func_array($f($f), func_get_args()); | |
}); | |
}; |
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 | |
function classNames() { | |
return join(' ', | |
array_map( | |
function ($arg) { | |
if (is_array($arg)) { | |
$values = []; | |
foreach ($arg as $className => $show) { | |
if ($show) { |
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
#include <stdio.h> | |
#include <string.h> | |
#include <stdint.h> | |
/** | |
* Convert an IPv4 address string into a long | |
* | |
* @param ip_addr IPv4 address string to convert | |
* @return long representation of IP | |
*/ |
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 | |
identify -format '%[EXIF:*]' $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
# Configure | |
git config --global merge.tool p4mergetool | |
git config --global mergetool.p4mergetool.cmd "/Applications/p4merge.app/Contents/Resources/launchp4merge \$PWD/\$BASE \$PWD/\$REMOTE \$PWD/\$LOCAL \$PWD/\$MERGED" | |
git config --global mergetool.p4mergetool.trustExitCode false | |
git config --global mergetool.keepBackup false | |
# Use with `git mergetool` |