This file contains hidden or 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
// ==UserScript== | |
// @name Pastafarize | |
// @description Replaces "God" with "Flying Spaghetti Monster" for the in-place edification of the faithful pastafarian via other religious texts. | |
// @grant none | |
// @exclude https://gist.github.com/* | |
// ==/UserScript== | |
var html = document.body.innerHTML; | |
html = html.replace(/God/g, "The Flying Spaghetti Monster"); | |
document.body.innerHTML = html; |
This file contains hidden or 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
# Zenburn colours scheme for Xfce Terminal updated for Xfce4-terminal 0.6.3. Copy and paste the following in ${HOME}/.config/xfce4/Terminal/terminalrc: | |
ColorBackground=#404040 | |
ColorForeground=#F6F3E8 | |
ColorCursor=#8f8fafaf9f9f | |
ColorPalette=#3f3f3f3f3f3f;#e8e893939393;#9e9ecece9e9e;#f0f0dfdfafaf;#8c8cd0d0d3d3;#c0c0bebed1d1;#dfdfafaf8f8f;#efefefefefef;#3f3f3f3f3f3f;#e8e893939393;#9e9ecece9e9e;#f0f0dfdfafaf;#8c8cd0d0d3d3;#c0c0bebed1d1;#dfdfafaf8f8f;#efefefefefef |
This file contains hidden or 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
/** | |
* Provide a 24 bit int implementation for DataViews. Note this | |
* causes two reads/writes per call, meaning it's going to be | |
* around half as fast as the native implementations. | |
*/ | |
DataView.prototype.getUint24 = function(pos) { | |
return (this.getUint16(pos) << 8) + this.getUint8(pos+2); | |
} | |
DataView.prototype.setUint24 = function(pos, val) { |
This file contains hidden or 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
describe("DataView", function() { | |
it("should implement Uint24 accessors", function() { | |
var i, n, buf, dv; | |
buf = new ArrayBuffer(3); | |
dv = new DataView(buf); | |
n = Math.pow(2, 24); | |
// this should give us decent coverage without trying every single number, which takes forever | |
for(i = 1; i < n; i += 111) { | |
dv.setUint24(0, i); | |
dv.getUint24(0).should.equal(i); |
This file contains hidden or 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
const should = require("should"); | |
should.Assertion.add("nearly", function(arr, delta) { | |
try { | |
for(let i = 0, len = arr.length; i < len; i++) { | |
this.obj[i].should.be.approximately(arr[i], delta); | |
} | |
} | |
catch(e) { | |
throw new Error("expected ["+this.obj.toString()+"] to be approximately ["+arr.toString()+"] ± "+delta); | |
} |
This file contains hidden or 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
# BULLET-TRAIN CONFIG | |
BULLETTRAIN_TIME_BG=000 | |
BULLETTRAIN_TIME_FG=008 | |
BULLETTRAIN_DIR_BG=001 | |
BULLETTRAIN_DIR_FG=007 | |
BULLETTRAIN_GIT_BG=000 | |
BULLETTRAIN_GIT_FG=008 | |
BULLETTRAIN_GIT_COLORIZE_DIRTY_BG_COLOR=000 | |
BULLETTRAIN_GIT_MODIFIED=" %F{006}✹%F{black}" |
This file contains hidden or 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
# Only directory, time & git are covered here | |
BULLETTRAIN_TIME_BG=000 | |
BULLETTRAIN_TIME_FG=008 | |
BULLETTRAIN_DIR_BG=001 | |
BULLETTRAIN_DIR_FG=007 | |
BULLETTRAIN_GIT_BG=000 | |
BULLETTRAIN_GIT_FG=008 | |
BULLETTRAIN_GIT_COLORIZE_DIRTY_BG_COLOR=000 | |
BULLETTRAIN_GIT_MODIFIED=" %F{006}✹%F{black}" |
This file contains hidden or 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
if(typeof(ArrayBuffer.prototype.transfer) === "undefined") { | |
ArrayBuffer.prototype.transfer = function transfer(old) { | |
var dva, dvb, i, mod; | |
dva = new DataView(this); | |
dvb = new DataView(old); | |
mod = this.byteLength%8+1; | |
for(i = 0; i <= old.byteLength-mod; i+=8) dva.setFloat64(i, dvb.getFloat64(i)); | |
mod = this.byteLength%4+1; | |
if(i < old.byteLength-mod) { | |
dva.setUint32(i, dvb.getUint32(i)); |
This file contains hidden or 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
// I don't know if this is the "right" way to do this, or even a "not stupid" way to do this, but I couldn't | |
// find an idiomatic approach and I'm a noob at Vulkan and graphics programming in general, so I came up with this | |
// the only reason it was difficult is that I first had to learn how Rust likes doing timing, using Duration and Instant | |
// rather than just using a ms/ns timestamp integer as one might expect | |
fn main() { | |
// [...] all your vulkan initialization stuff | |
// this is the target FPS | |
let fps = 60u32; | |
// set up a Duration representing the frame interval |
This file contains hidden or 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 | |
# | |
# Enable port forwarding | |
# | |
# Based on another script found somewhere else, but this one gets user/pass automatically and requires sudo. | |
# | |
# Usage: | |
# $ sudo piaport | |
port_forward_assignment( ) |
OlderNewer