Skip to content

Instantly share code, notes, and snippets.

Avatar
🦊
⭐️ ⭐️ ⭐️

Deepu Mohan Puthrote WarFox

🦊
⭐️ ⭐️ ⭐️
View GitHub Profile
@WarFox
WarFox / install-and-setup-openblas-and-lapack.sh
Created August 15, 2022 13:06
Installing lapack and openblas for building scipy on MacOS
View install-and-setup-openblas-and-lapack.sh
#!/usr/env bash
brew install openblas
brew install lapack
# Set the following environment variables so that the build tools can find the libraries.
# openblas
export LDFLAGS="-L/usr/local/opt/openblas/lib $LDFLAGS"
export CPPFLAGS="-I/usr/local/opt/openblas/include $CPPFLAGS"
export PKG_CONFIG_PATH="/usr/local/opt/openblas/lib/pkgconfig $PKG_CONFIG_PATH"
@WarFox
WarFox / replace-section-in-file.bash
Last active January 26, 2022 12:19
Replace section in a file
View replace-section-in-file.bash
#!/usr/bin/env bash
file_with_anchor_text=$1
file_with_new_content=$2
BEGIN_TEXT='<!-- BEGIN anchor text --!>'
END_TEXT='<!-- END anchor text --!>'
function get_line_number() {
local text=$1
@WarFox
WarFox / 1. generate-key-pair.fish
Last active June 5, 2021 17:25
Generate RS256 key pair for asymmetric jwt signing
View 1. generate-key-pair.fish
openssl genrsa -out jwt-private.pem 2048
openssl rsa -in jwt-private.pem -pubout -out jwt-public.pem
@WarFox
WarFox / date-sequence.clj
Created August 19, 2019 23:22
Generate infinite date sequences
View date-sequence.clj
(ns warfox.date
(:import [java.time LocalDate]
[java.time.temporal ChronoUnit]))
(defn date-seq
"Returns lazy sequence of dates starting from `start`"
[^LocalDate start]
(lazy-seq
(cons start
(date-seq (.plusDays start 1)))))
@WarFox
WarFox / spark-submit.el
Last active June 5, 2021 17:26
Submit a apache spark job from Emacs. I use this with Spacemacs to run spark jobs locally
View spark-submit.el
;; Change these
(setq project-name "project-name"
main-class-name "canonical.name.of.main.class"
version "0.0.0"
project-root (projectile-project-root)
log4j-configuration (s-lex-format "file://${project-root}/log4j.properties")
config-file (concat project-root "app.conf"))
(defun spark-submit-command(class-name java-options jar-location)
(let ((command (s-lex-format
View keybase.md

Keybase proof

I hereby claim:

  • I am warfox on github.
  • I am deepu (https://keybase.io/deepu) on keybase.
  • I have a public key ASCrBcADwFjYASFkJKpn0GksuDURXbLCLf0cFVLohhxcxwo

To claim this, I am signing this object:

@WarFox
WarFox / keybase.md
Created November 8, 2017 15:49
keybase verification
View keybase.md

Keybase proof

I hereby claim:

  • I am warfox on github.
  • I am warfox (https://keybase.io/warfox) on keybase.
  • I have a public key ASC2qFxzXcPpH1Uu3xyJGINTfjwJ7LqXj5geqOFgZAVW3wo

To claim this, I am signing this object:

View *scratch*.txt
sample gist from emacs gist.el
`SPC g g b`
@WarFox
WarFox / scala-sbt-project-structure.sh
Last active June 1, 2018 16:15
Script to create Scala SBT project directory structure
View scala-sbt-project-structure.sh
#!/usr/bin/env bash
touch build.sbt ; touch README.md; mkdir -p project; touch project/plugins.sbt; mkdir -p src/{main/{scala,resources,java},test/{scala,resources,java}}/
@WarFox
WarFox / install-kibana-on-multiple-nodes.sh
Last active October 14, 2016 14:46
Install Kibana on multiple remote servers.
View install-kibana-on-multiple-nodes.sh
#!/usr/bin/env bash
kibana_nodes=(server1 server2 server3)
elasticsearch_url=http://myelasticsearch.com
function install_kibana {
echo "install kibana"
sudo rpm -i https://download.elastic.co/kibana/kibana/kibana-4.6.1-x86_64.rpm
}