Skip to content

Instantly share code, notes, and snippets.

@faizzed
faizzed / investmentCalculator.kts
Created May 23, 2021 14:58
Investment Calculator
/**
* S&P 500 from 2010 to 2019, the average stock market return for the last 10 years is 11.805%
* This can be different for other indexes. We can make a dictionary of returns and see how others compare to it.
*
* Given a static amount or added over the years we can see how it will look like after x years.
*
* */
class InvestmentCalculator(val initial: Double, val returnPercentage: Double, val years: Int) {
/*
server {
  listen 80;
  server_name mydomain.com;
  #
  #
  #
  #
  location / {
 access_log off;
@faizzed
faizzed / create_nginx_server.sh
Last active August 11, 2020 15:34
This script creates a starter nginx server block, install ssl cert, setup a src directory and add entry to hosts file. Written for OSX.
#!/usr/bin/env bash
printf "
---\n
This script will do the following:\n
- Make an nginx server config\n
- Create an ssl cert for it\n
- Add the cert to trusted cert db.\n
- Make a src folder ready to to be edited.\n\n
This is just to get started faster. Please make relevant edits.
--\n";
@faizzed
faizzed / Setting-up-docker-sync-on-MAC.md
Last active August 9, 2020 12:48
Setting up docker sync on MAC

Install docker-sync

sudo gem install docker-sync

Add docker-sync volumes

docker-sync.yml

version: "2"
syncs:
  
@faizzed
faizzed / out.sh
Created April 10, 2020 12:09
Color print text in console
#!/usr/bin/env bash
END='\e[0m';
BOLD='\e[1m';
DIM='\e[2m';
ITALIC='\e[3m';
UNDERLING='\e[4m';
BLINK='\e[5m';
GHOST='\e[8m';
STRIKE_THROUGH='\e[9m';
@faizzed
faizzed / php_console_logging.php
Created March 9, 2020 12:57
PHP - A simple class for logging into stderr
<?php
class Console
{
private $stderr = null;
private $line = null;
const END = '\e[0m';
const BOLD = '\e[1m';
const DIM = '\e[2m';
const ITALIC = '\e[3m';
#!/usr/bin/env bash
if [ "$1" == "" ]; then
printf "First argument should be filename.."
exit
fi
file="$1"
### Set initial time of file
#! /usr/bin/env bash
# setting compound GOPATH @ ~/.bashrc
# 3rd party libraries
export GOPATH=~/go/lib
export PATH=$PATH:$GOPATH/bin
# personal workspace
export GOPATH=$GOPATH:~/go/projects
@faizzed
faizzed / request.php
Last active February 23, 2020 08:30
php curl request module
<?php
/**
* A nice little request module using php curl,
* handy for looking up things quickly. Not intended for any major purpose
* or tweak it yourself
*
* @param $url string
* @param $method string
* @param $data array
#!/usr/bin/env bash
if [ "$1" == "" ]; then
printf "Can not commit with out a message. exiting!\n"
exit
fi
git add -A && git commit -m "$1";