Skip to content

Instantly share code, notes, and snippets.

:shipit:
&droider

Nishant Srivastava nisrulz

:shipit:
&droider
Block or report user

Report or block nisrulz

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
@nisrulz
nisrulz / build_akira_for_ubuntu.sh
Last active May 27, 2019
Build from source and install Akira on Ubuntu (18.0.4.2)
View build_akira_for_ubuntu.sh
#!/bin/bash
# This is the main script, only execute this to install all dependencies and finally Akira.
# Once done, you can find Akira icon in your applications menu.
# Execute by: ./build_akira_for_ubuntu.sh
# Install Vala Language:
sudo apt install vala-0.40-doc valac-0.40-vapi valac
# Build Granite (make sure this script is in the same folder)
@nisrulz
nisrulz / androidDevAliases.sh
Created Apr 15, 2018
All of my android development aliases.
View androidDevAliases.sh
# I use ZSH, here is what I added to my .zshrc file (config file)
# at ~/.zshrc
# ------------------ Android ------------------ #
# Have the adb accessible, by including it in the PATH
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:path/to/android_sdk/platform-tools/"
# Setup your Android SDK path in ANDROID_HOME variable
export ANDROID_HOME=~/sdks/android_sdk
@nisrulz
nisrulz / appBuildInstallLaunchAlias.sh
Last active Jan 13, 2019
Append these aliases to your bashrc/zshrc and you will have access to commands which will allow you to install apk and launch apk
View appBuildInstallLaunchAlias.sh
# I use ZSH, here is what I added to my .zshrc file (config file)
# at ~/.zshrc
# Have the adb accessible, by including it in the PATH
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:path/to/android_sdk/platform-tools/"
# Setup your Android SDK path in ANDROID_HOME variable
export ANDROID_HOME=~/sdks/android_sdk
# Setup aapt tool so it accessible using a single command
View SystemUiHelper.java
/*
* Copyright (C) 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@nisrulz
nisrulz / MainActivity.java
Created Sep 17, 2017
Making your Android Library, Lifecycle-Aware blog post code snippet: MainActivity class after lifecycle components have been integrated
View MainActivity.java
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Add Lifecycle Observer
getLifecycle().addObserver(AwesomeLibMain.getInstance());
}
@nisrulz
nisrulz / AwesomeLibMain.java
Created Sep 17, 2017
Making your Android Library, Lifecycle-Aware blog post code snippet: AwesomeLibMain class after lifecycle components have been integrated
View AwesomeLibMain.java
import android.arch.lifecycle.Lifecycle;
import android.arch.lifecycle.LifecycleObserver;
import android.arch.lifecycle.OnLifecycleEvent;
public class AwesomeLibMain implements LifecycleObserver {
static final AwesomeLibMain ourInstance = new AwesomeLibMain();
public static AwesomeLibMain getInstance() {
return ourInstance;
}
@nisrulz
nisrulz / MainActivity.java
Created Sep 17, 2017
Making your Android Library, Lifecycle-Aware blog post code snippet: MainActivity class
View MainActivity.java
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Init
AwesomeLibMain.getInstance().init();
}
@nisrulz
nisrulz / AwesomeLibMain.java
Last active Sep 17, 2017
Making your Android Library, Lifecycle-Aware blog post code snippet: AwesomeLibMain class
View AwesomeLibMain.java
public class AwesomeLibMain {
static final AwesomeLibMain ourInstance = new AwesomeLibMain();
public static AwesomeLibMain getInstance() {
return ourInstance;
}
private AwesomeLibMain() {
}
@nisrulz
nisrulz / pr.md
Created Jul 28, 2017 — forked from piscisaureus/pr.md
Checkout github pull requests locally
View pr.md

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@nisrulz
nisrulz / loadcsv2dataframe.py
Created Jun 9, 2017
Read and load a csv file into pandas data frame
View loadcsv2dataframe.py
import pandas as pd
import csv
with open("<filename>.csv", 'r') as f:
with open("updated_file.csv", 'w') as f1:
f.next() # skip header line
f.next() # skip header empty line
for line in f:
f1.write(line.replace('\x00', ''))
You can’t perform that action at this time.