Skip to content

Instantly share code, notes, and snippets.

@qcom
qcom / git-filter-branch-move-files.md
Created Jun 8, 2020 — forked from fabiomaggio/git-filter-branch-move-files.md
Use git filter-branch to move all projects files to a subdir and rewrite all commits
View git-filter-branch-move-files.md
  1. Clone project

  2. Checkout all branches that contain the files that should be moved

  3. Delete the remote

  4. Run the filter-branch command:

    git filter-branch --tree-filter 'mkdir -p /path/to/tmp; mv * /path/to/tmp; mkdir subdir; mv /path/to/tmp/* subdir/' --tag-name-filter cat --prune-empty -- --all
    • All files are first copied to a temporary dir and move from there to the new destination
    • Existing tags are updated
View power
US wall power outlet <–––> Transformer [hard-wired power cord; male]
Transformer [OUTPUT 220V port; female] <–––> UK power cord [male]
UK power cord [female] <–––> Technics [AC power socket]
View out
> err
{ handle: 2,
type: 'error',
className: 'Error',
constructorFunction: { ref: 10 },
protoObject: { ref: 11 },
prototypeObject: { ref: 1 },
properties:
[ { name: 'stack', attributes: 2, propertyType: 3, ref: 1 },
{ name: 'message', attributes: 2, propertyType: 0, ref: 12 },
View gulpfile.js
gulp.task('jsx', function() {
return browserify({
entries: paths.reactEntryPoints,
extensions: ['jsx'],
debug: true
}).transform(babelify.configure({
presets: ['es2015', 'stage-1', 'react']
})).bundle()
.on('error', function(err) { console.error(err.message); this.emit('end'); })
.pipe(source('components.js'))
@qcom
qcom / bookshelf.js
Created Nov 25, 2015
bookshelf initialization
View bookshelf.js
var config = require('config');
var knex = require('knex')({
client: 'pg',
connection: config.get('postgresConnstring'),
debug: process.env.NODE_ENV === 'development'
});
var bookshelf = require('bookshelf')(knex);
View getPosByQuery.js
'use strict';
var request = require('request');
var url = 'https://google.com';
module.exports = function(address, cb) {
request(url, function(err, res, body) {
if (err) throw err;
console.log(body);
});
@qcom
qcom / out.txt
Created Sep 27, 2015
longjohn stack trace with NODE_DEBUG=net,tls
View out.txt
NET 84539: _read
NET 84539: Socket._read readStart
NET 84539: _read
NET 84539: Socket._read readStart
NET 84539: _read
NET 84539: Socket._read readStart
NET 84539: destroy undefined
NET 84539: destroy
NET 84539: close
NET 84539: close handle
@qcom
qcom / out.txt
Created Sep 27, 2015
longjohn stack trace
View out.txt
[127.0.0.1] GET /search?search=92119&option=location @2015-09-27T12:18:39-07:00
{ [Error: error 209.242.169.194 GET /search?search=92119&option=location]
code: 'ECONNRESET',
level: 'error',
timestamp: '2015-09-27T19:18:39.318Z' }
Error: socket hang up
at TLSSocket.onHangUp (_tls_wrap.js:1032:19)
at TLSSocket.g (events.js:260:16)
at emitNone (events.js:72:20)
at TLSSocket.emit (events.js:166:7)
View Rater.js
class Rater {
constructor() {
}
}
module.exports = Rater;
View error.out
{ [Error: read ECONNRESET] code: 'ECONNRESET', errno: 'ECONNRESET', syscall: 'read' }
Error: read ECONNRESET
at exports._errnoException (util.js:746:11)
at TCP.onread (net.js:559:26)