Skip to content

Instantly share code, notes, and snippets.

View electron0zero's full-sized avatar
🎯
Focusing

Suraj Nath electron0zero

🎯
Focusing
View GitHub Profile
@electron0zero
electron0zero / keybase.md
Created February 10, 2017 02:07
my keybase verification

Keybase proof

I hereby claim:

  • I am electron0zero on github.
  • I am electron0zero (https://keybase.io/electron0zero) on keybase.
  • I have a public key ASA_iB5JeTWzhJt6cf3US-TRIzzsYJgx9nf_EsypEhY4sgo

To claim this, I am signing this object:

@keyboardr
keyboardr / ContentListFragment.java
Last active January 6, 2018 23:37
Demonstrate how to use the empty view to show progress indication and handle empty state. Note: if using a normal Fragment, you should call ListView.setEmptyView() to assign the empty view to the ListView.
public class ContentListFragment extends ListFragment implements LoaderCallbacks<List<Content>>{
@Override
public void onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
return inflater.inflate(R.layout.layout, container, false);
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState){
super.onViewCreated(view, savedInstanceState);
getLoaderManager().initLoader(0, null, this);
@nefarioustim
nefarioustim / project-euler-problem-1.2.js
Created June 5, 2011 12:37
Find the sum of all the multiples of 3 or 5 below 1000.
// Do the maths
for(
var sum = 0, i = 1;
i < 1000;
!(i % 3 && i % 5) && (sum += i), i++
);
// Log the result
console.log(sum);
@bhtucker
bhtucker / prediction_variance.ipynb
Created November 12, 2016 22:21
Demo of some ideas for detecting noisy groups of observations in a multiclass classification setting
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@DStruths
DStruths / README.md
Last active November 22, 2019 02:06
d3.js Multi-series line chart interactive

Please note, data will be randomised until December 2014. It is based on Ipsos MORI's long term Issues Index survey 1974 - 2014.

@deepak
deepak / ruby_thread_parent.rb
Created November 1, 2010 11:30
keep track of the parent of a ruby thread.rb
T0 = Thread.main
t1 = Thread.new(Thread.current) { |x| Thread.current[:parent] = x; sleep 1_00_000; }
t2 = Thread.new(Thread.current) { |x| Thread.current[:parent] = x; sleep 1_00_000; }
(t1[:parent] == t2[:parent]) && (t1[:parent] == T0)
__END__
# to find out the parent of a thread, ie. was spawned by which thread
@osowski
osowski / incept-minikube.sh
Last active April 16, 2020 23:28
Install Minikube, Kubectl, and Virtualbox on Ubuntu
#Installing VirtualBox
echo "Installing VirtualBox........................"
sudo apt-get install virtualbox
#Installing kubectl https://kubernetes.io/docs/getting-started-guides/kubectl/
echo "Installing kubectl..........................."
wget https://storage.googleapis.com/kubernetes-release/release/v1.4.4/bin/linux/amd64/kubectl
chmod +x kubectl
sudo mv kubectl /usr/local/bin/kubectl
@electron0zero
electron0zero / .bash_aliases
Last active October 22, 2020 18:48
my ~/.bash_aliases and kubectl_aliases
# === Bash functions that are used in aliases
# get bash shell on docker container.
# works only if one container is running
function get_bash_docker() {
count=$(docker ps -q | wc -l)
if [[ $count = 1 ]]; then
container_id=$(docker ps -q)
echo "Getting bash shell in ${container_id}"
docker exec -it ${container_id} bash
@rfratto
rfratto / non_global_metrics.go
Last active February 17, 2021 20:44
One way to do non-global Prometheus metrics in an application
package main
import (
"os"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
"github.com/prometheus/common/expfmt"
)
@passiondroid
passiondroid / RuntimePermissionHelper.java
Last active February 26, 2021 05:51
Android Runtime Permission Helper class
import android.Manifest;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.util.Log;