Skip to content

Instantly share code, notes, and snippets.

/*
* Template backbone.js code that encapsulates a
* datatable.net table within a view for a hypothetical ;)
* auction listings application.
*/
var HomeRouter = Backbone.Router.extend({
routes: {
'refresh' : 'refresh',
var oldSync = Backbone.sync;
Backbone.sync = function(method, model, options){
options.beforeSend = function(xhr){
xhr.setRequestHeader('X-CSRFToken', CSRF_TOKEN);
};
return oldSync(method, model, options);
};
@a3linux
a3linux / index.html
Created January 6, 2016 01:57 — forked from agarzon/index.html
My Html5 template with Jquery and Bootstrap from CDN
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Project Title</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width">
<meta name="description" content="">
<link rel="shortcut icon" href="favicon.ico">
@a3linux
a3linux / curl-ttfb.sh
Created March 1, 2016 03:11 — forked from acdha/curl-ttfb.sh
Use curl to measure and report HTTP response times (pre-, start- and total transfer)
#!/bin/bash
#
# Report time to first byte for the provided URL using a cache buster to ensure
# that we're measuring full cold-cache performance
while (($#)); do
echo $1
curl -so /dev/null -H "Pragma: no-cache" -H "Cache-Control: no-cache" \
-w "%{http_code}\tPre-Transfer: %{time_pretransfer}\tStart Transfer: %{time_starttransfer}\tTotal: %{time_total}\tSize: %{size_download}\n" \
"$1?`date +%s`"
@a3linux
a3linux / gist:602ea54fc8ab771459332039425dc46e
Created November 3, 2016 01:35 — forked from rhelmer/gist:a053aedb863ef3d7d317
quick sync script for symbols
#!/usr/bin/env python
"""
A quick sync script for symbols from NFS->S3
We can't simply record the time our sync script ran and find all newer files
since files with timestamps in the past may appear. So, keep track of all .txt
index files that we encounter, and only sync files when there are additions
to that set.
"""
@a3linux
a3linux / gist:4d0ab1cf13d11fcf0f96281a47692e8f
Created November 3, 2016 01:35 — forked from rhelmer/gist:d3d99bd60e81be10f759
quick sync setup runner for symbols
#!/bin/bash
set -e
. /home/socorro/.virtualenvs/aws/bin/activate
PRIVATE_BUCKET="org.mozilla.crash-stats.symbols-private/v1"
PUBLIC_BUCKET="org.mozilla.crash-stats.symbols-public/v1"
TOP_DIR="/mnt/socorro/symbols"
PRIVATE_DIRS="symbols_adobe"
@a3linux
a3linux / .jsbeautifyrc
Created March 23, 2017 08:36 — forked from softwarespot/.jsbeautifyrc
JS Beautifier configuration
// Documentation: https://github.com/beautify-web/js-beautify
// Example URL: https://github.com/victorporof/Sublime-HTMLPrettify/blob/master/.jsbeautifyrc
// Based on Airbnb's JavaScript Style Guide, URL: https://github.com/airbnb/javascript
{
// Collapse curly brackets
"brace_style": "collapse",
// Break chained method calls across subsequent lines
"break_chained_methods": true,
@a3linux
a3linux / ec2-ami-region-map.py
Created January 31, 2018 06:13 — forked from pacohope/ec2-ami-region-map.py
Given a starting public AWS AMI, generate a YAML list of AMI IDs for that AMI in all AWS regions.
#
# Given the ID of an Amazon public AMI in one region, figure out what the
# equivalent AMI IDs are for that same AMI in all other regions known.
# If that AMI isn't defined in a region, it prints the region's name, but
# comments it out.
#
from __future__ import print_function
import boto3
@a3linux
a3linux / role_arn_to_session.py
Created April 11, 2018 08:09 — forked from gene1wood/role_arn_to_session.py
Simple python function to assume an AWS IAM Role from a role ARN and return a boto3 session object
import boto3
def role_arn_to_session(**args):
"""
Usage :
session = role_arn_to_session(
RoleArn='arn:aws:iam::012345678901:role/example-role',
RoleSessionName='ExampleSessionName')
client = session.client('sqs')
"""
@a3linux
a3linux / gist:29ea91ce8f5cb40b1265882f8ac6374a
Created June 18, 2018 04:33 — forked from eternnoir/gist:7701964
pandoc markdown to pdf chinese template
\documentclass[$if(fontsize)$$fontsize$,$endif$$if(lang)$$lang$,$endif$$if(papersize)$$papersize$,$endif$$for(classoption)$$classoption$$sep$,$endfor$]{$documentclass$}
\XeTeXlinebreaklocale "zh"
\XeTeXlinebreakskip = 0pt plus 1pt
\usepackage{titlesec}
\titleformat{\section}{\LARGE\filcenter}{}{1em}{}
\titleformat{\subsection}{\Large\filcenter}{}{1em}{}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{amssymb,amsmath}
\usepackage{ifxetex,ifluatex}