Skip to content

Instantly share code, notes, and snippets.

View acterry's full-sized avatar

Aaron Terry acterry

View GitHub Profile
#!/bin/bash
#1) on https://console.developers.google.com/ register project, enable Groups Migration API, and create OAuth2 credentials.
#2) set the client_id and client_secret variables below to the values provided when creating the OAuth2 credentials.
#3) make copies of the Client ID and Client Secret for the OAuth2 credentials and use them
client_id="..."
client_secret="...."
#4) get authorization code at the following link using web browser
# (make sure you sign in with an account that has access to Google Groups you are importing to).
@benbjurstrom
benbjurstrom / Code.gs
Last active April 12, 2024 11:05
PurgeOldEmails
/*
|--------------------------------------------------------------------------
| PurgeOldEmails
|--------------------------------------------------------------------------
| https://gist.github.com/benbjurstrom/00cdfdb24e39c59c124e812d5effa39a
|
*/
// Purge messages automatically after how many days?
var DELETE_AFTER_DAYS = 7
@matthewsuan
matthewsuan / axios.js
Last active March 28, 2024 12:36
Axios request queue-like that limits number of requests at any given time
import axios from 'axios'
const MAX_REQUESTS_COUNT = 5
const INTERVAL_MS = 10
let PENDING_REQUESTS = 0
// create new axios instance
const api = axios.create({})
/**
@jcouyang
jcouyang / README.org
Last active December 9, 2023 16:46
Promise All with Limit of Concurrent N

The Promise All Problem

in case of processing a very large array e.g. Promise.all(A_VERY_LARGE_ARRAY_OF_XHR_PROMISE)

which would probably blow you browser memory by trying to send all requests at the same time

solution is limit the concurrent of requests, and wrap promise in thunk

Promise.allConcurrent(2)([()=>fetch('BLAH1'), ()=>fetch('BLAH2'),...()=>fetch('BLAHN')])

@askilondz
askilondz / gistlog.yml
Last active April 2, 2024 10:44
Adaptive Streaming with MPEG-DASH and HLS using AWS

Adaptive Streaming has become the neccessity for streaming video and audio. Unfortantely, as of this post, there isn't a whole lot of tutorials that accumulate all of the steps to get this working. Hopefully this post achieves that. This post focuses on using Amazon Web Services (AWS) to transcode for HLS and DASH and be the Content Delivery Network (CDN) that delivers the stream to your web page. We'll be using Video.js for the HTML5 player as well as javascript support libaries to make Video.js work with HLS and DASH.

So Here's what you need:

Set up three S3 buckets

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?

@juanpasolano
juanpasolano / blacklist.conf
Last active April 9, 2016 14:55
Blacklist spam referal
map $http_referer $bad_referer {
hostnames;
default 0;
"~seo-platform.com" 1;
"~qualitymarketzone.com" 1;
"~video--production.com" 1;
"~hongfanji.com" 1;
"~iloveitaly.com" 1;
"~iloveitaly.co" 1;
"~fbdownloader.com" 1;
@mattes
mattes / boot2docker-nfs.rb
Last active December 4, 2023 12:07
docker-machine/ boot2docker with NFS instead of vboxsf
#!/usr/bin/env ruby
# Usage
# $ docker-machine create my-machine123 -d virtualbox
# $ ruby <(curl -L https://git.io/vvvco) my-machine123
# https://gist.github.com/mattes/4d7f435d759ca2581347
require 'erb'
bootlocalsh = %Q(#/bin/bash
@JamoCA
JamoCA / dnsjava.cfm
Last active October 1, 2021 21:03
Better ColdFusion DNS Look-ups using dnsjava.
<cfscript>
/* add dnsjava-*.jar to java path. Download from http://www.dnsjava.org/ */
thisDomain = "google.com";
dnsjava = createobject("java", "org.xbill.DNS.Address");
dnsResponse = dnsjava.getAllByName(thisDomain);
ips = [];
if (isArray(dnsResponse)){
for(i=1; i <= ArrayLen(dnsResponse); i++){
arrayappend(ips, dnsResponse[i].getHostAddress());
}
@algal
algal / nginx-cors.conf
Created April 29, 2013 10:52
nginx configuration for CORS (Cross-Origin Resource Sharing), with an origin whitelist, and HTTP Basic Access authentication allowed
#
# A CORS (Cross-Origin Resouce Sharing) config for nginx
#
# == Purpose
#
# This nginx configuration enables CORS requests in the following way:
# - enables CORS just for origins on a whitelist specified by a regular expression
# - CORS preflight request (OPTIONS) are responded immediately
# - Access-Control-Allow-Credentials=true for GET and POST requests