Skip to content

Instantly share code, notes, and snippets.

View atdt's full-sized avatar
💭
I may be slow to respond.

Ori Livneh atdt

💭
I may be slow to respond.
  • Google
  • New York City
View GitHub Profile

How to setup a practically free CDN using Backblaze B2 and Cloudflare

⚠️ 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,

#!/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
@ethagnawl
ethagnawl / coupon-codes.txt
Created October 30, 2017 04:59
Top 100 Ecommerce Coupon Codes
# source: https://www.slideshare.net/CouponFollow/top-100-most-common-coupon-code-phrases
fall
twitter
black
MEMORIAL
TWEET20
FREESHIP
earlybird
MONDAY
holidays
@pascalpoitras
pascalpoitras / config.md
Last active April 28, 2024 23:12
My WeeChat configuration

WeeChat Screenshot

Mouse


enable


@nticaric
nticaric / BoyerMoore.php
Last active July 16, 2022 08:25
Boyer–Moore algorithm implementation in PHP
<?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
*/
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active May 2, 2024 05:55
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@paulirish
paulirish / moved.md
Last active October 1, 2015 01:38 — forked from dmethvin/gist:1676346
Breakpoint on access to a property
@mmalecki
mmalecki / ansispan.js
Created November 27, 2011 19:20
My finite state machine for parsing ANSI codes
var ansispan = function (str) {
}
ansispan.parse = function (str) {
//
// I'm terrible at writing parsers.
//
var matchingControl = null,
matchingData = null,
matchingText = null,
@dtjm
dtjm / cramfs-osx.diff
Created September 9, 2011 20:52
cramfs patch for OS X
--- 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_
@dbrgn
dbrgn / queryset_generators.py
Created April 1, 2011 08:41
queryset_generator and queryset_list_generator
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.