Skip to content

Instantly share code, notes, and snippets.

Ryan Day soldair

Block or report user

Report or block soldair

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
soldair / tarball-rewrite-file-paths.js
Last active Feb 14, 2019
easiest way to create a tarball with a file called seahorse.txt with the contents and attributes of a file called file.txt
View tarball-rewrite-file-paths.js
// easiest way to create a tarball with a file called seahorse.txt
// with the contents and attributes of a file called file.txt
let Header = require('tar/lib/header')
let ReadEntry = require('tar/lib/read-entry')
let Pack = require('tar/lib/pack.js')
let modeFix = require('tar/lib/mode-fix')
let fs = require('fs')
soldair / package.json
Last active Feb 23, 2018
coverage doesn't include service worker js reduced test case
View package.json
"name": "pupeteer-service-worker-coverage-test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"bin": {
"b48a0022dbef999f241881f80d7575a9": "./service-worker-test.js"
"author": "Ryan Day",
"license": "MIT",
soldair / query_local.js
Created Oct 26, 2017
query/parse out all /mydb/_local keys in your couchdb data file
View query_local.js
var fs = require('fs')
var rs = fs.createReadStream(PATH TO YOUR DATABASE FILE.couch)
var match = new Buffer('_local/')
var matchi = 0
for(var i=0;i<b.length;++i) bite(b,i)
View gist:c8b7479ad69d7e2e257b30c92802e7d0
curl -s | grep 'id":"_'
soldair /
Created Sep 5, 2017
make a read only npm token
curl -sLi -X PUT -H 'content-type: application/json' -d '{"name": "USERNAME", "token": true, "password": "PASSWORD", "readonly": true, "email": "EMAIL"}' ''
soldair /
Created Feb 20, 2017
idnoe debug commands
# list inode use for /
df -Ti /
# find dirs with lots of files
sudo find / -xdev -printf '%h\n' | sort -T /mnt/tmp | uniq -c | sort -T /mnt/tmp/ -k 1 -n
# run apt autoremove with a different cache dir
sudo apt-get -o dir::cache::archives="/mnt/tmp" autoremove -f
View etag
soldair / versions.json
Created Mar 25, 2016
versions that failed to publish.
View versions.json
soldair / tailfd-dir.js
Last active Feb 8, 2016
tailfd directory example
View tailfd-dir.js
var fs =require('fs')
var path = require('path')
// these will need to be in the package.json
var tailfd = require('tailfd')
var through = require('through2')
// use:
// var taildir = require('./')
// var stream = taildir(dir)
// stream.on('data',function(data){
// console.log(data.line)
soldair / read-end-of-file.js
Created Aug 26, 2015
read the end of a file
View read-end-of-file.js
var fs = require('fs')
// usage example:
// var t = require('./this-file.js')
// t('/var/log/boot.log',1024,function(err,data){ console.log(data+'')})
module.exports = function(file,lastNBytes,cb){
var fd, size, called
var orig = cb
var start = function fn(err,data){
You can’t perform that action at this time.