⚠️ Note 2023-01-21
Some things have changed since I originally wrote this in 2016. I have updated a few minor details, and the advice is still broadly the same, but there are some new Cloudflare features you can (and should) take advantage of. In particular, pay attention to Trevor Stevens' comment here from 22 January 2022, and Matt Stenson's useful caching advice. In addition, Backblaze, with whom Cloudflare are a Bandwidth Alliance partner, have published their own guide detailing how to use Cloudflare's Web Workers to cache content from B2 private buckets. That is worth reading,
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
#!/usr/bin/env bash | |
# Map Caps Lock key to Left Control key | |
# https://developer.apple.com/library/content/technotes/tn2450/_index.html | |
# This doesnt work. Reverts on restart | |
# hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000039,"HIDKeyboardModifierMappingDst":0x7000000E0}]}' | |
# References: | |
# https://github.com/mathiasbynens/dotfiles/issues/310 | |
# https://gist.github.com/scottstanfield/0f8ce63271bebfb5cf2bb91e72c71f91 | |
# The last link didnt work for me on Sierra or High Sierra. I could not find IOHIDKeyboard but |
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
# source: https://www.slideshare.net/CouponFollow/top-100-most-common-coupon-code-phrases | |
fall | |
black | |
MEMORIAL | |
TWEET20 | |
FREESHIP | |
earlybird | |
MONDAY | |
holidays |
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
<?php | |
/** | |
* Returns the index of the first occurrence of the | |
* specified substring. If it's not found return -1. | |
* | |
* @param text The string to be scanned | |
* @param pattern The target string to search | |
* @return The start index of the substring | |
*/ |
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
var ansispan = function (str) { | |
} | |
ansispan.parse = function (str) { | |
// | |
// I'm terrible at writing parsers. | |
// | |
var matchingControl = null, | |
matchingData = null, | |
matchingText = null, |
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
--- cramfs-1.1/cramfsck.c 2011-09-09 13:39:01.000000000 -0700 | |
+++ cramfs-dtjm/cramfsck.c 2011-09-09 13:39:02.000000000 -0700 | |
@@ -47,14 +47,17 @@ | |
#include <stdlib.h> | |
#include <errno.h> | |
#include <string.h> | |
-#include <sys/sysmacros.h> | |
#include <utime.h> | |
#include <sys/ioctl.h> | |
#define _LINUX_STRING_H_ |
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 queryset_generator(queryset, chunksize=1000): | |
""" | |
Iterate over a Django Queryset ordered by the primary key | |
This method loads a maximum of chunksize (default: 1000) rows in its | |
memory at the same time while django normally would load all rows in its | |
memory. Using the iterator() method only causes it to not preload all the | |
classes. | |
Note that the implementation of the generator does not support ordered query sets. |
NewerOlder