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
commit fdf95587884d38743234a4ff227ac608cb40e5e8 | |
Author: Justen Robertson <[email protected]> | |
Date: Sat Aug 21 00:56:56 2021 -0700 | |
[UPDATE] 0.51.2 | |
diff --git a/PKGBUILD b/PKGBUILD | |
index 8784e1f..6a09041 100644 | |
--- a/PKGBUILD | |
+++ b/PKGBUILD |
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 | |
# Transmission address binding & port configurator for transmission-gtk (does not apply to transmission daemon) | |
# | |
# This script relies on my other script, piaport: https://gist.github.com/nphyx/e24c5349469f8dbca627761fafd57fbe | |
# It also requires gawk, and assumes it's in /usr/bin/gawk. If it's somewhere else for you change it. | |
# | |
# It must be run manually whenever VPN goes down and up again. | |
# | |
# You should already have bind-address-ipv4 and bind-address-ipv6 configured in your transmission settings.json! | |
# |
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( ) |
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
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
# 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
# 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
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
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
/** | |
* 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) { |
NewerOlder