Skip to content

Instantly share code, notes, and snippets.

View puzza007's full-sized avatar
💭
💅

Paul Oliver puzza007

💭
💅
View GitHub Profile
@puzza007
puzza007 / main.rs
Created July 22, 2019 01:11 — forked from sargun/main.rs
#[macro_use]
extern crate slog;
extern crate sloggers;
use sloggers::Build;
use sloggers::terminal::{Destination, TerminalLoggerBuilder};
use slog::Logger;
use std::str::FromStr;
#[macro_use]
extern crate chan;
extern crate nix;
@puzza007
puzza007 / springer-free-maths-books.md
Created December 30, 2015 02:24 — forked from bishboria/springer-free-maths-books.md
Springer have made a bunch of books available for free, here are the direct links
@puzza007
puzza007 / or_or_or.erl
Last active December 27, 2015 12:29 — forked from mietek/or_or_or.erl
-module(or_or_or).
-compile(export_all).
f1(X) ->
if
length(X) =:= 1; size(X) =:= 1 ->
okay;
true ->
nope
@puzza007
puzza007 / mig.py
Created March 15, 2013 15:54 — forked from Jach/mig.py
'''
Steps:
1. Create any milestones
2. Create any labels
3. Create each issue, linking them to milestones and labels
3.1: Update status for new issue if closed
4: Create all the comments for each issue
'''
import getpass
import json
####################################
# BASIC REQUIREMENTS
# http://graphite.wikidot.com/installation
# http://geek.michaelgrace.org/2011/09/how-to-install-graphite-on-ubuntu/
# Last tested & updated 10/13/2011
####################################
sudo apt-get update
sudo apt-get upgrade
@puzza007
puzza007 / gist:1481140
Created December 15, 2011 13:46 — forked from kevsmith/gist:1473809
deadcode detecting escript
#!/usr/bin/env escript
%% -*- erlang -*-
%% Find unused exports in a given module
%% Example: deadcode mod_foo deps/foo/ebin deps/bar/ebin
%% Assumes this script is in a file named deadcode
main([Module0|Dirs]) ->
Module = list_to_atom(Module0),
{ok, _Pid} = xref:start(foo),
"""Modifies the App Engine datastore to support local caching of entities.
This is achieved by monkeypatching google.appengine.ext.db to recognise model
classes that should be cached and store them locally for the duration of a
single page request.
Note that only datastore gets (and anything that relies on them, such as
ReferenceProperty fetches) are cached; queries will neither return cached
entities nor update the cache.
Params = #amqp_params{
username = iolist_to_binary(User),
password = iolist_to_binary(Password),
virtual_host = iolist_to_binary(Vhost),
host = Host,
port = Port
},
Params = #amqp_params{
username = iolist_to_binary(User),
password = iolist_to_binary(Password),
%% If this occurs in something that's called often (and might qualify as an inner loop,
%% or might not) does either method have a speed advantage?
[A,B,C] = [get_foo(S) || S<-["a","b","c"],
% versus
A = get_foo("a"),
B = get_foo("b"),
C = get_foo("c"),
%%
%% Simple pool for gen_servers that only use :call
%%
-module(gen_server_call_pool).
-behaviour(gen_server).
%% --------------------------------------------------------------------
%% External exports
-export([start_link/3, stats/1]).