Skip to content

Instantly share code, notes, and snippets.

View P7h's full-sized avatar

Prashanth Babu P7h

  • London, UK
View GitHub Profile
@P7h
P7h / Install_7zip_on_Linux.md
Last active October 4, 2023 04:46
7zip install on Linux -- Ubuntu and Fedora or CentOS / RHEL

Steps to install 7zip on Linux » Ubuntu and Fedora or CentOS / RHEL

Ubuntu

cat /etc/*release
sudo apt-get update -yqq
sudo apt-get install -yqq p7zip-full
@P7h
P7h / Bash_command_line_shortcuts.md
Created September 13, 2016 14:44
Bash command line Shortcuts

Bash command line Shortcuts

Picked these from here

Command Editing Shortcuts

Command Note
Ctrl + a go to the start of the command line
Ctrl + e go to the end of the command line
Ctrl + k delete from cursor to the end of the command line
@P7h
P7h / Dockerfile
Last active September 18, 2016 11:55
Docker Image for GHC v8.0.1 and Cabal v1.24
FROM ubuntu
MAINTAINER Prashanth Babu <Prashanth.Babu@gmail.com>
RUN apt-get update && \
apt-get install -yqq software-properties-common screen vim && \
add-apt-repository -y ppa:hvr/ghc && \
apt-get update && \
apt-get install -yqq cabal-install-1.24 ghc-8.0.1 && \
apt-get clean && \

Keybase proof

I hereby claim:

  • I am P7h on github.
  • I am p7h (https://keybase.io/p7h) on keybase.
  • I have a public key whose fingerprint is A775 C217 20FF C0CE E9D1 E60C EFB3 9713 80D4 F9CD

To claim this, I am signing this object:

@P7h
P7h / setup_spark_env.sh
Last active January 16, 2019 12:08
Download and setup [from the command line] Java, Scala, SBT and Spark on a Ubuntu machine.
### This script downloads and sets up the following binaries.
## Java: 8u91
## Scala: 2.11.8
## SBT: 0.13.11
## Spark: 1.6.1
sudo usermod -a -G sudo hduser
## Install the essential packages.
sudo apt-get install ssh zip p7zip p7zip-full multitail htop screen tmux -y # subversion git python-pip
@P7h
P7h / Java8DateTimeFormattingAndParsing.scala
Last active April 14, 2016 21:57
Formatting and parsing date and time with Java 8
import java.time._
import java.time.format.DateTimeFormatter
val date = "Sun Apr 03 05:40:58 +0200 2016"
val formatter = DateTimeFormatter.ofPattern("EE MMM dd HH:mm:ss ZZ yyyy")
val parsedDate = LocalDateTime.parse(date, formatter)
// parsedDate: java.time.LocalDateTime = 2016-04-03T05:40:58
val parsedDateTZ = ZonedDateTime.parse(date, formatter)
// parsedDateTZ: java.time.ZonedDateTime = 2016-04-03T05:40:58+02:00
@P7h
P7h / SparkML-QuickRef.md
Created March 24, 2016 10:12 — forked from jreuben11/SparkML-QuickRef.md
Spark.ml Pipelines QuickRef

in a nutshell: fit trainingData (train a model), transform testData (predict with model)

  • Transformer: DataFrame => DataFrame
  • Estimator: DataFrame => Transformer

#Transformers

  • Tokenizer: sentence => words
  • RegexTokenizer: sentence => words - setPattern
  • HashingTF: terms => feature vectors based on frequency - setNumFeatures
@P7h
P7h / jdk7_download.sh
Created July 17, 2015 08:29
JDK 7 command line download script; For JDK8, please check: https://gist.github.com/P7h/9741922
##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### #####
#### Command line download script for JDK7 from Oracle website.
#### For JDK8, please check: https://gist.github.com/P7h/9741922
#### Oracle does not release JDK 7 public updates effective April, 2015; for more info: http://www.oracle.com/technetwork/java/javase/documentation/eol-135779.html.
## Last JDK7 version: JDK7u79
BASE_URL_7=http://download.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79
## Previous versions
@P7h
P7h / tmux.cheat
Last active February 7, 2019 15:38 — forked from afair/tmux.cheat
========================================== ==========================================
TMUX COMMAND WINDOW (TAB)
========================================== ==========================================
List tmux ls List ^b w
New -s <session> Create ^b c
Attach att -t <session> Rename ^b , <name>
Rename rename-session -t <old> <new> Last ^b l (lower-L)
Kill kill-session -t <session> Close ^b &
@P7h
P7h / cpu_info.py
Last active August 29, 2015 14:23
Python snippets for quickly finding the platform type, cpu and memory stats of a Linux machine.
###### CPU Info of a Linux machine.
### Picked from: http://echorand.me/site/notes/articles/python_linux/article.html
from __future__ import print_function
from collections import OrderedDict
import pprint
def cpuinfo():
cpuinfo=OrderedDict()
procinfo=OrderedDict()
nprocs = 0