Skip to content

Instantly share code, notes, and snippets.

Avatar

Prashanth Babu P7h

View GitHub Profile
@P7h
P7h / Install_7zip_on_Linux.md
Last active Aug 6, 2020
7zip install on Linux -- Ubuntu and Fedora or CentOS / RHEL
View Install_7zip_on_Linux.md

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 Sep 13, 2016
Bash command line Shortcuts
View Bash_command_line_shortcuts.md

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 Sep 18, 2016
Docker Image for GHC v8.0.1 and Cabal v1.24
View Dockerfile
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 && \
View keybase.md

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 Jan 16, 2019
Download and setup [from the command line] Java, Scala, SBT and Spark on a Ubuntu machine.
View setup_spark_env.sh
### 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 Apr 14, 2016
Formatting and parsing date and time with Java 8
View Java8DateTimeFormattingAndParsing.scala
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 Mar 24, 2016 — forked from jreuben11/SparkML-QuickRef.md
Spark.ml Pipelines QuickRef
View SparkML-QuickRef.md

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 Jul 17, 2015
JDK 7 command line download script; For JDK8, please check: https://gist.github.com/P7h/9741922
View jdk7_download.sh
##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### #####
#### 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
View 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 Aug 29, 2015
Python snippets for quickly finding the platform type, cpu and memory stats of a Linux machine.
View cpu_info.py
###### 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
You can’t perform that action at this time.