Skip to content

Instantly share code, notes, and snippets.

View fahadsiddiqui's full-sized avatar

Fahad Siddiqui fahadsiddiqui

View GitHub Profile
@fahadsiddiqui
fahadsiddiqui / .hyper.js
Created September 10, 2020 19:59
My Hyper.is terminal configuration.
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// choose either `'stable'` for receiving highly polished,
// or `'canary'` for less polished but more frequent updates
updateChannel: 'stable',
@fahadsiddiqui
fahadsiddiqui / copy.go
Created September 3, 2020 20:58 — forked from r0l1/copy.go
Copy a directory tree (preserving permissions) in Go.
/* MIT License
*
* Copyright (c) 2017 Roland Singer [roland.singer@desertbit.com]
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
@fahadsiddiqui
fahadsiddiqui / v1.polymerapp.io.nginx
Created June 2, 2020 20:34
Nginx configuration for v1 server.
server {
root /var/www/v1.polymerapp.io/html;
index index.html index.htm index.nginx-debian.html;
server_name v1.polymerapp.io;
location / {
try_files $uri $uri/ /index.html $uri/ =404;
}
@fahadsiddiqui
fahadsiddiqui / zeppelin_docker_9376.md
Last active May 27, 2020 13:39
Run Apache Zeppelin docker container with port number 9376.

The logs directory will be your $PWD/.zeppelin_logs and the notebook directory will be $PWD/.notebook:/notebook.

Create Folders

If you dont create folders before running the next command, the folders will be created as the root user, which will be problematic for the container to create .git/ and other folders in there. You can simply fix that too, by doing sudo chown -R $USER .zeppelin_logs .notebook.

mkdir -p $PWD/.zeppelin_logs $PWD/.notebook
@fahadsiddiqui
fahadsiddiqui / test_data_mysql.md
Created May 12, 2020 16:16
Preparing test docker-ized mysql database.

First of all generate the data, here is an interesting tool to do that https://pypi.org/project/csvfaker/

Create test_data/ folder and use csvfaker to put data in there

csvfaker -r 100000 first_name last_name email ssn job country phone_number user_name zipcode invalid_ssn credit_card_number credit_card_provider credit_card_security_code bban > test_data/pii_data.csv

Then create a docker container using image mysql:5.7 and mount volume test_data/

@fahadsiddiqui
fahadsiddiqui / mutliple_dirs.sh
Last active March 10, 2020 08:08
Create multiple directories in one `mkdir` command.
# create in from a list
mkdir -p temp/{api,logs,whatnot}
# create all from A to Z
mkdir -p temp/{A..Z}
import java.math.BigInteger
import java.nio.file._
import java.security.MessageDigest
import scala.collection.JavaConverters
def sha512Hash(p: String): String = {
val path = Paths.get(p)
val text = JavaConverters
.asScalaBuffer(Files.readAllLines(path))
unameOut="$(uname -s)"
case "${unameOut}" in
Linux*) machine=Linux;;
Darwin*) machine=Mac;;
CYGWIN*) machine=Cygwin;;
MINGW*) machine=MinGw;;
*) machine="UNKNOWN:${unameOut}"
esac
echo ${machine}
ifconfig | grep -G "192.168.*.255" | cut -d' ' -f10
# OR
hostname -I | cut -d' ' -f1
@fahadsiddiqui
fahadsiddiqui / ps1_settings.sh
Last active December 6, 2019 12:03
My latest PS1 settings on bash terminal.
export PS1="\[\033[01;31m\][\t]\[\033[00m\] \[\033[01;34m\]\w\[\033[00m\] \[\033[01;35m\]>\[\033[00m\] "