Skip to content

Instantly share code, notes, and snippets.

sam-at-github

  • 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
View _make_iterencode.py
''' 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
ValueError=ValueError,
dict=dict,
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
sam-at-github / index.html
Last active Mar 11, 2017
utility-function-editor-mock
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Spline Curve Editor</title>
<style>
* { 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)
View dpkg-compare-file-hash.sh
#!/bin/bash
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."
View make_file_tree.sh
#!/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.
DEPTH=2
WIDTH=10
FSIZE=10000
DORANDOM=1
#WRITEPROBABILITY=5
function rec_make_tree() {
You can’t perform that action at this time.