Skip to content

Instantly share code, notes, and snippets.


  • Australia
Block or report user

Report or block sam-at-github

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
''' Override certain function from built-in json module to allow formatting of JSON two container types
, arrays and objects, to be optionally specified separately by allowing `indent` to be a 2-tuple.
I copied this from Python 3.5.3 but looks about the same in 3.4-3.6. Probably wont work in >=3.7.
def _make_iterencode(markers, _default, _encoder, _indent, _floatstr,
_key_separator, _item_separator, _sort_keys, _skipkeys, _one_shot,
## HACK: hand-optimized bytecode; turn globals into locals
View editable-bar-chart.js
* Presents a bar graph with mutatable bars. The use can click on one bar and drag to change its
* height and corresponding value. The user can click and drag to select >1 and simultaneously
* change thier values.
class EditableBarChart
* Init. We need to explicitly deal with margins ~because axes.
sam-at-github / index.html
Last active Mar 11, 2017
View index.html
<!DOCTYPE html>
<meta charset="utf-8">
<title>Spline Curve Editor</title>
* { border: 0; padding: 0; margin: 0; }
html, body { height: 100%; }
body {
font: 13px sans-serif;
View audiolevelmeter.cpp
#include <stdlib.h>
#include <math.h>
#include <iostream>
#include <QDebug>
#include <QAudioDeviceInfo>
#include <qendian.h>
#include "audiolevelmeter.h"
AudioLevelMeter::AudioLevelMeter(QObject *parent)
: QObject(parent)
fail() {
echo "$@"
exit 1
[[ -z "$1" ]] && fail "Usage: $0 <path to file to check>"
FILE=`readlink -f "$1"`
[[ -f "$FILE" ]] || fail "File must exist. $FILE does not."
#!/bin/bash -e
# Make a balanced file tree with files full of random bytes for testing purposes.
# Script takes three parameters depth, width, and filesize.
function rec_make_tree() {
You can’t perform that action at this time.