This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <math.h> | |
#include <iostream> | |
#include <QDebug> | |
#include <QAudioDeviceInfo> | |
#include <qendian.h> | |
#include "audiolevelmeter.h" | |
AudioLevelMeter::AudioLevelMeter(QObject *parent) | |
: QObject(parent) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' 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, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mongoose = require('mongoose'); | |
var getTestConnection = require('./getTestConnection.js'); | |
var UserSchema = new mongoose.Schema({ | |
name: { type: String, required: true }, | |
notes: { | |
type: Map, | |
of: String, | |
default: {}, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
enum Gender : String, Codable { | |
case M, F | |
} | |
struct User : Codable { | |
let name: String | |
let email: String | |
let gender: Gender | |
let verified: Bool |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# git clone git@github.com:sgpinkus/mime-db.git && cd mime-db && git checkout origin/add-mime-support | |
const db = require('./db'); | |
const fs = require('fs'); | |
const lodash = require('lodash'); | |
let mimeSupport = lodash.pickBy(db, x => x.source === 'mime-support'); | |
mimeSupport = Object.entries(mimeSupport).map(([k, v]) => { return { mime: k, ...v }; }); | |
fs.writeFileSync('mime-support-additional.json', JSON.stringify(mimeSupport, null, 2)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Simplified Infinite Scroll</title> | |
<meta charset="utf-8" /> | |
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script> | |
<style type='text/css'> | |
* { border: 0; padding: 0; margin: 0; box-sizing: border-box; } | |
html, body { height: 100%; } | |
body { display: flex; flex-flow: column wrap; } |
OlderNewer