Skip to content

Instantly share code, notes, and snippets.

View danielhavir's full-sized avatar

Daniel Havir danielhavir

View GitHub Profile
@danielhavir
danielhavir / query.go
Last active October 1, 2019 06:51
Simple utility CLI interface for encryption, IP querying and some other functions. Build and move the binary to "~/.local/bin"
package main
import (
"crypto/rand"
"flag"
"fmt"
"io/ioutil"
"log"
"net/http"
"os/exec"
@danielhavir
danielhavir / install-go.sh
Last active March 29, 2021 23:53
Install/Uninstall Golang (https://golang.org/)
#!/bin/bash
# Resource 1: https://golang.org/doc/install#install
# Resource 2: https://alexatnet.com/install-go-on-raspberry-pi/
version="1.12"
machine=`uname -m`
bold=$(tput bold)
yellow=$(tput setaf 3)
green=$(tput setaf 2)
if [ $# -ne 2 ];then
echo "Usage: `basename $0` idVendor idProduct"
exit 1
fi
for X in /sys/bus/usb/devices/*; do
if [ "$1" == "$(cat "$X/idVendor" 2>/dev/null)" -a "$2" == "$(cat "$X/idProduct" 2>/dev/null)" ]
then
echo "$X"

Keybase proof

I hereby claim:

  • I am danielhavir on github.
  • I am danielhavir (https://keybase.io/danielhavir) on keybase.
  • I have a public key ASDEKLlI3mzQBn3N1IThJD64Xb7T-vHA8XxTKcX4-u5rOgo

To claim this, I am signing this object:

tput setaf 6; echo '#### Downloading and installing Anaconda ####'; tput sgr0;
wget https://repo.anaconda.com/archive/Anaconda3-5.3.0-Linux-x86_64.sh
bash ./Anaconda3-5.3.0-Linux-x86_64.sh
tput setaf 2; echo '#### Anaconda has been successfully installed ####'; tput sgr0;
# Stop Xorg
sudo systemctl stop lightdm.service
# Remove .deb packages and Anaconda installer
rm -f Anaconda* nvidia* cuda*
tput setaf 6; echo '#### Downloading and installing CUDA ####'; tput sgr0;
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin
sudo mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget http://developer.download.nvidia.com/compute/cuda/11.0.2/local_installers/cuda-repo-ubuntu2004-11-0-local_11.0.2-450.51.05-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu2004-11-0-local_11.0.2-450.51.05-1_amd64.deb
sudo apt-key add /var/cuda-repo-ubuntu2004-11-0-local/7fa2af80.pub
sudo apt-get update
sudo apt-get -y install cuda
@danielhavir
danielhavir / install_cudnn.sh
Created March 12, 2018 15:30
Extract CuDNN, copy files to CUDA directory and create symbolic links
### CuDNN Installation Script ###
### Download CuDNN from: https://developer.nvidia.com/cudnn ###
### Reference 1: http://docs.nvidia.com/deeplearning/sdk/cudnn-install/index.html ###
### Reference 2: https://stackoverflow.com/questions/42013316/after-building-tensorflow-from-source-seeing-libcudart-so-and-libcudnn-errors/44147506#44147506 ###
## Create variables
### CHANGE THESE ###
export cudnn_version=cudnn-8.0-linux-x64-v7.1
export version=7.1.1
export cuda_dir=/usr/local/cuda
import bson # pip install pymongo
import numpy as np
import pandas as pd
import os
from tqdm import tqdm_notebook
out_folder = 'images'
# Create output folder
if not os.path.exists(out_folder):
@danielhavir
danielhavir / die_javascript.sh
Last active July 30, 2018 15:49
JavaScript Must Die!
### Removes Node and NPM from mac OS ###
# Uninstall using NPM
npm uninstall npm -g || echo "NPM uninstall didn't work"
# Try if Node's installed with Brew
(brew uninstall node&&brew prune)||echo "Node was not installed with Brew"
# Remove all files and folders including Node or NPM
rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/{npm*,node*,man1/node*}
rm -rf /usr/local/bin/npm /usr/local/share/man/man1/node* /usr/local/lib/dtrace/node.d ~/.npm ~/.node-gyp /opt/local/bin/node opt/local/include/node /opt/local/lib/node_modules
rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/npm*
rm -rf /usr/local/include/node*
country year co2
China 1962 0.651705172948
India 1962 0.307620146391
Japan 1962 3.1103547047
Russia 1962 7.91397623629
United Kingdom 1962 11.1388081316
United States 1962 15.5606900155
China 1963 0.637538142643
India 1963 0.323658671475
Japan 1963 3.41488661345