Skip to content

Instantly share code, notes, and snippets.

View gnithin's full-sized avatar
🙂
Pink moon gonna get us all

Nithin Gangadharan gnithin

🙂
Pink moon gonna get us all
View GitHub Profile
@gnithin
gnithin / init.vim
Last active January 9, 2018 08:18
My vim configuration
"let g:pymode_python='python3'
" Ignoring PEP8 - (Especially for Palermo. Enable it later)
let g:pymode_lint_ignore="E501,W601"
" Mandatory stuff that vundle needs
set nocompatible
filetype off
" set rtp+=~/.vim/bundle/vundle/
" call vundle#rc()
@gnithin
gnithin / My .screenrc
Last active August 29, 2015 14:24
Adding my screen configuration
#Shutting off the startup message
startup_message off
#Keeping a hardstatus
hardstatus alwayslastline
#Adding the screen bottom line
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %d-%m %{W}%c %{g}]'
#increasing the scroll back buffer
@gnithin
gnithin / bash_aliases.sh
Last active February 8, 2017 09:53
My bash_aliases
# For making a directory and then entering it.
mkdr_function(){
mkdir $1 && cd $1
}
alias mkcd=mkdr_function
# For starting up rofi(2&>1 and >/dev/null are for supressing the std ops and err ops)
# alias rofi_up="rofi -key-window shift+q 2&>1 >/dev/null &"
# For obvious screw-ups
@gnithin
gnithin / moo.sh
Last active August 29, 2015 14:27
A fortune message,said by a cow, that will keep popping up every 60 seconds :P Inspired by http://www.reddit.com/r/programming/comments/3gd4xt/a_tweetable_turing_machine/ctxeqxi
interval=60
while true;
do
fortune -n 50 -s|
cowsay |
xargs -0 notify-send -t 8 fortune;
sleep $interval;
done
@gnithin
gnithin / PHP Overview.md
Last active April 20, 2020 23:43
The good and the bad and the ugly of PHP

What I don't like about php -

  • Different extensions for mysql (There has to be only one proper way to do stuff and migrating between them is HARD)
  • Using references introduces a bucket-load of hard to debug bugs - (Eg: Always set the ref as null after using it, especially when used inside a foreach )
  • Library bugs ( Eg: mb_substr has length param as upper bound on number of CHARs to use (Even if encoding is provided). It's actually the number of bytes, the community doesn't accept that as an error, but it was supposedly intended )
  • utf8_encode is badly named. It's supposed to convert from ISO-8859-1 to utf-8. It ain't a magic wand.
  • Inconsistency in function details. For example -
    array_map	 ( callable $callback, array $array1...)
    array_filter ( array $array, callable $callback...)
    
@gnithin
gnithin / helper_plugin.cs
Last active September 20, 2016 12:12
Helper plugin for partitioning user ids in WebTest
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.VisualStudio.TestTools.WebTesting;
using System.Diagnostics;
namespace ClassLibrary2
{
public class NewClass : WebTestPlugin
@gnithin
gnithin / customJSONextractor.cs
Last active September 20, 2016 05:35
Custom Json Extractor
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.WebTesting;
using System.Globalization;
using Newtonsoft.Json.Linq;
namespace CustomJSONExtractor
@gnithin
gnithin / to_remove.php
Last active September 21, 2016 11:34
Dummy
<?php
function get_x509_public_key($x509_raw, $debug=FALSE)
{
// Insert a '\r\n' every 64 bits
$x509_raw_chunked = chunk_split($x509_raw, 64);
$x509_text = '-----BEGIN CERTIFICATE-----' . "\n" . $x509_raw_chunked . '-----END CERTIFICATE-----';
//$x509_ar = openssl_x509_parse($x509_text);
@gnithin
gnithin / react-native-notes.md
Last active November 30, 2016 21:05
Notes for the React tutorial and a setting up and woring with react native

Some notes on setting up and working with react-native

I am trying react-native for android (I have a ubuntu distro and an android phone).

Setting it up

I've downloaded the things mentioned here. It's a lot of stuff to download to be honest. Just follow them to the letter. Do NOT try to skip things.

Create a project like this -

@gnithin
gnithin / pre-push-hook.sh
Last active December 30, 2016 22:05
A pre-push hook that runs a script, performs a commit and pushes again recursively (Refer to the SO answer mentioned)
#!/bin/sh
# This basically is a pre-push git hook.
# It's run after a connection is established with the remote and before anything is pushed.
# This script basically does this -
# - Executes a file
# - Adds the changes made, to git
# - Pushes the commit to remote
# To prevent the last push to recursively call this hook infinitely,
# referred to this awesome answer (point 3) - http://stackoverflow.com/a/21334985/1518924