Skip to content

Instantly share code, notes, and snippets.

anonymous
anonymous / meta.html
Created November 17, 2011 07:37
Double meta refresh for flask
<html>
<head>
<meta name="robots" content="noindex" />
<meta http-equiv="refresh" content="0; url={{ url }}" />
</head>
</html>
@jboner
jboner / latency.txt
Last active November 19, 2024 14:58
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@deltheil
deltheil / nginx.conf
Created June 4, 2012 07:57
Hide sensitive GET parameters within nginx access logs thanks to the Lua module
http {
log_format filt '$remote_addr - $remote_user [$time_local] "$_request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
server {
location /login {
# `set` is provided by the Rewrite module
set $filter "password|secret";
@felixcollins
felixcollins / AssetLibraryReadStream.cs
Created October 28, 2012 20:06
Monotouch - Stream Wrapper for AssetRepresentation
using System;
using System.IO;
using MonoTouch;
using MonoTouch.Foundation;
using MonoTouch.AssetsLibrary;
namespace StreamHelper
{
/// <summary>
package com.opengles.hellotriangle;
/*
* Copyright (C) 2008 The Android Open Source Project 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
* http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
* or agreed to in writing, software distributed under the License is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the specific language
import os, argparse
import tensorflow as tf
"""
This script converts a checkpoint to a pb file without needing to know
the names of the input and output nodes. This then allows you to use the
Tensorflow tool summarize_graph to identify potential input/output nodes.
Usage:
@stecman
stecman / AutoCrop.lua
Last active August 31, 2024 21:25
Lightroom plugin to calculate image crops using OpenCV
-- LR imports
local LrApplication = import("LrApplication")
local LrApplicationView = import("LrApplicationView")
local LrBinding = import("LrBinding")
local LrDevelopController = import("LrDevelopController")
local LrDialogs = import("LrDialogs")
local LrExportSession = import("LrExportSession")
local LrFileUtils = import("LrFileUtils")
local LrFunctionContext = import("LrFunctionContext")
local LrLogger = import("LrLogger")
@uahim
uahim / arte_v2.sh
Last active May 19, 2024 14:41
May 2024: this will no longer work as arte stopped serving http mp4 hosting; script stays up for reference
#!/bin/bash
# usage
# arte_v2.sh <url>
# now also displays the link to high quality direct download of the mp4 and supports arte concert
# important:
# requires jq, which is "like sed for JSON data" ( https://stedolan.github.io/jq/ )
# replace with your preferred user agent