Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am fredrocious on github.
  • I am fredrocious (https://keybase.io/fredrocious) on keybase.
  • I have a public key ASDoModt52V1stIt7RCNBv_dYHaL8ap-3KEScEP66jhLigo

To claim this, I am signing this object:

@chengfred
chengfred / S3-Static-Sites.md
Created March 29, 2018 17:39 — forked from bradwestfall/S3-Static-Sites.md
Use S3 and CloudFront to host Static Single Page Apps (SPAs) with HTTPs and www-redirects. Also covers deployments.

S3 Static Sites

What this will cover

  • Host a static website at S3
  • Redirect www.website.com to website.com
  • Website can be an SPA (requiring all requests to return index.html)
  • Free AWS SSL certs
  • Deployment with CDN invalidation

Resources

@chengfred
chengfred / 4sq_categories-emoji.swift
Created October 23, 2017 18:27 — forked from garethpaul/4sq_categories-emoji.swift
Trying to map all the Foursquare categories (https://developer.foursquare.com/categorytree) to emojis ✌️
let categories = [
"56aa371be4b08b9a8d5734db":"🎶", // Amphitheaters
"4fceea171983d5d06c3e9823":"🐠", // Aquariums
"4bf58dd8d48988d1e1931735":"🎮", // Arcades
"4bf58dd8d48988d1e2931735":"🖼", // Art Galleries
"4bf58dd8d48988d1e4931735":"🎳", // Bowling Alleys
"4bf58dd8d48988d17c941735":"🎰", // Casinos
"52e81612bcbc57f1066b79e7":"🎪", // Circuses
"4bf58dd8d48988d18e941735":"😂", // Comedy Clubs
"5032792091d4c4b30a586d5c":"🎶", // Concert Halls
@chengfred
chengfred / gist:55b50ffb628937c5f3cc
Created March 4, 2015 18:34
Changing default schema for a field to use replace for diffs
POST https://api.simperium.com/1/<app id>/__options__/i/<bucket name>
{ "schema" : { "attributes" : { "<fieldname>" :{ "otype" : "replace" } } } }
Example:
App ID: test-app-1337
Bucket Name: blarb
Field Name: b64thing
@chengfred
chengfred / gist:08ca1c8ad81543309421
Created August 29, 2014 19:28
manually generate cv for Aug.1 2014
$ python
Python 2.7.8 (default, Jul 2 2014, 10:14:46)
[GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from bson.objectid import ObjectId
>>> import datetime
>>> ObjectId.from_datetime(datetime.datetime(2014, 8, 1))
ObjectId('53dad8800000000000000000')
require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({"0+/Abx":[function(require,module,exports){
/**
* Diff Match and Patch
*
* Copyright 2006 Google Inc.
* http://code.google.com/p/google-diff-match-patch/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@chengfred
chengfred / gist:7684946
Created November 27, 2013 23:34
multiple clientids used with same ccid - top 10 results sorted based on # of dup ccids
{
"result" : [
{
"_id" : {
"ccid" : "e60cb8f485c14efbb70340588c271780"
},
"total" : 48,
"clids" : [
"android-0.4.0-beta-be5999",
"android-0.4.0-beta-7222ae",
@chengfred
chengfred / CHANGES.md
Last active December 27, 2015 02:49 — forked from beaucollins/SYNCING.md

API Changes

1.1

  • For the cv command, if the supplied parameter is not formatted properly or we cannot return all the changes from that cursor, the response will now be cv:?. Previously, the server responded with c:?

  • If the server determines the supplied connection credentials are no longer valid, previously the server responded with two messages:

    • auth:expired
    • auth:{"msg":"Token invalid","code":401}
  • Now, the server will only respond in the error case with the second message (the JSON error object).

import socket
import tornado
import tornado.ioloop
import tornado.iostream
import client
import functools
class LockdClientTornado( client.LockdClient ):

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name: