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
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
//@ts-check
// 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
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
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
rs.on('data',function(b){
for(var i=0;i<b.length;++i) bite(b,i)
})
View gist:c8b7479ad69d7e2e257b30c92802e7d0
curl -s https://replicate.npmjs.com/registry/_changes | grep 'id":"_'
{"seq":2,"id":"_design/scratch","changes":[{"rev":"1-4136ab2028eaa41eeb63e22b028172a0"}]},
{"seq":3,"id":"_design/app","changes":[{"rev":"1-4136ab2028eaa41eeb63e22b028172a0"}]},
@soldair
soldair / readonly.sh
Created Sep 5, 2017
make a read only npm token
View readonly.sh
curl -sLi -X PUT -H 'content-type: application/json' -d '{"name": "USERNAME", "token": true, "password": "PASSWORD", "readonly": true, "email": "EMAIL"}' 'https://registry.npmjs.org/-/user/org.couchdb.user:USERNAME'
@soldair
soldair / inode-debug.sh
Created Feb 20, 2017
idnoe debug commands
View inode-debug.sh
# 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 halp.md
@soldair
soldair / versions.json
Created Mar 25, 2016
versions that failed to publish.
View versions.json
[
["angular-zinfinitescroll","1.1.2"],
["conforma","1.19.9"],
["jscripty","2.1.1"],
["cue-cli","1.5.18"],
["rdfw","0.0.1"],
["rdfw","0.0.2"],
["binder-utils","1.0.0"],
["tidying-media-codec-audio","0.2.1"],
["tidying-media-codec-audio-aac","0.2.1"],
@soldair
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
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.