Skip to content

Instantly share code, notes, and snippets.

@glamp
glamp / svmflag.py
Last active March 5, 2021 06:59
Plotting SVM predictions using matplotlib and sklearn
import numpy as np
import pylab as pl
import pandas as pd
from sklearn import svm
from sklearn import linear_model
from sklearn import tree
from sklearn.metrics import confusion_matrix
void TestReadingMMap()
{
double bytesRead = 0;
double elapsed = 0;
mapped_file_source file;
__int64 checksum = 0;
{
auto_cpu_timer timer;
file.open("C:\SomeBigFile.dat", 2147483647);
@aphyr
aphyr / gist:5198654
Created March 19, 2013 18:17
Thoughts on configuration file complexity.

Some people think that configuration should not be "Turing complete"; others think the configuration language should be as expressive as possible--so much so that it amounts to a programming language itself.

I assert that configuration files which are not Turing complete (or, perhaps a more useful distinction, are not "sufficiently complex languages") are in practice extended to be that complex; and when that happens, the result is often more difficult to understand than if the language were more powerful to start with.

@dstufft
dstufft / a.txt
Last active December 16, 2015 00:38
1. Set /etc/hosts to:
127.0.0.1 pages.github2.com
127.0.0.1 github2.com
2. Install flask and run python e.py
3. Go to http://github2.com:5000/set/
4. Go to http://pages.github:5000/read/ if "foo!" is displayed, subdomain can
read parent cookie, if "NOPE" then it can't.
@macintux
macintux / gist:5418295
Last active December 16, 2015 10:09
Draft of a blog post (or possibly a series of posts) diving into the meat of several key Riak configuration parameters. Internal links do not work, but I haven't worried about that since I'm not sure how closely GFM maps to Basho's blogging platform.
@claws
claws / bomau_publisher.py
Last active April 22, 2016 18:13
Publish Australian weather observations to MQTT
#!/usr/bin/env python
'''
Chris Laws 2013
Publish Australian weather observations over MQTT.
This script periodically retrieves weather observations from the
Australia Bureau of Meteorology. The source data comes from a file
@broach
broach / gist:5544483
Created May 8, 2013 23:34
Multi-threaded store example
import com.basho.riak.client.IRiakClient;
import com.basho.riak.client.IRiakObject;
import com.basho.riak.client.RiakException;
import com.basho.riak.client.RiakFactory;
import com.basho.riak.client.bucket.Bucket;
import com.basho.riak.client.operations.StoreObject;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.Callable;
@bootandy
bootandy / python_logging.yaml
Last active August 26, 2021 07:14
Sample logging config file for python logging module
# use with: logging.config.dictConfig(yaml.load(open('logging.yaml', 'r')))
# Formatters detailed here: http://docs.python.org/2/library/logging.html#logrecord-attributes
version: 1
formatters:
simple:
format: '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
detail:
format: '%(asctime)s - %(levelname)s - File: %(filename)s - %(funcName)s() - Line: %(lineno)d - %(message)s'
@adamwiggins
adamwiggins / adams-heroku-values.md
Last active September 6, 2025 20:29
My Heroku values

Make it real

Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discuss around concrete examples, not hand-waving abstractions. Don't say you did something, provide a URL that proves it.

Ship it

Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.

Do it with style

#!/bin/bash
HOSTNAME="${COLLECTD_HOSTNAME:-`hostname -f`}"
INTERVAL="${COLLECTD_INTERVAL:-10}"
while sleep "$INTERVAL"
do
info=$(curl http://myriak/stats -H "accept: text/plain")