Skip to content

Instantly share code, notes, and snippets.

View guerrato's full-sized avatar

Pedro Guerrato guerrato

View GitHub Profile
@txels
txels / rebase-onto.md
Last active December 19, 2018 02:00
Rebase a git branch onto another

Change the base branch for your current branch

Some cases:

  • you started a bugfix out of develop, but it should be applied to a release branch
  • you started on a branch and want to rebase it on some colleague's changes

Command

@umidjons
umidjons / write-append-file.js
Created January 5, 2014 08:02
NodeJS: Write/Append into a file
var f='write.txt',
fs=require('fs');
fs.writeFile(f,'Some text to write.',function(err){
if(err)
console.error(err);
console.log('Written!');
});
fs.appendFile(f,'Some more text to append.',function(err){
@cjus
cjus / jsonval.sh
Created June 26, 2011 17:42
Extract a JSON value from a BASH script
#!/bin/bash
function jsonval {
temp=`echo $json | sed 's/\\\\\//\//g' | sed 's/[{}]//g' | awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]}' | sed 's/\"\:\"/\|/g' | sed 's/[\,]/ /g' | sed 's/\"//g' | grep -w $prop`
echo ${temp##*|}
}
json=`curl -s -X GET http://twitter.com/users/show/$1.json`
prop='profile_image_url'
picurl=`jsonval`