Skip to content

Instantly share code, notes, and snippets.

View sidcha's full-sized avatar
💡
Thinking...

Siddharth Chandrasekaran sidcha

💡
Thinking...
View GitHub Profile
@sidcha
sidcha / ..git-pr.md
Created April 7, 2020 12:13 — forked from gnarf/..git-pr.md
git pr - Global .gitconfig aliases for Pull Request Managment

Install

Either copy the aliases from the .gitconfig or run the commands in add-pr-alias.sh

Usage

Easily checkout local copies of pull requests from remotes:

  • git pr 4 - creates local branch pr/4 from the github upstream(if it exists) or origin remote and checks it out
  • git pr 4 someremote - creates local branch pr/4 from someremote remote and checks it out
@sidcha
sidcha / split-patch.pl
Created April 21, 2019 09:38
Splits or dissects large patch file into smaller per-file-change patches. Comes in handy when patches don't apply anymore.
#!/bin/perl
while (<>) {
if(/^diff --git a\/(\S+)/) {
close $f if $f;
$s=$1;
$s =~ s:(/|\.):_:g;
$n=sprintf("%03d_%s.patch", ++$i, $s);
open $f, ">", $n;
print $f $_;
@sidcha
sidcha / read_line.c
Last active April 21, 2019 09:51
A single file readline implementation. Written in a classroom for educational purpose. This code will not be supported.
/******************************************************************************
Copyright (c) 2017 Siddharth Chandrasekaran
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: