Skip to content

Instantly share code, notes, and snippets.

View mranawake's full-sized avatar
🤷‍♀️
heh

Madara Ranawake mranawake

🤷‍♀️
heh
  • Homewise Solutions Inc.
  • Brampton, Ontario, Canada
View GitHub Profile
@mranawake
mranawake / tfswitch_install_notes.txt
Last active September 12, 2023 15:44
TFSWITCH Install Notes
1 - Install following these instructions: https://tfswitch.warrensbox.com/Install/
2 - If you run into permission related issues, uninstall (https://tfswitch.warrensbox.com/Upgrade-or-Uninstall/)
and install again using these instructions: https://tfswitch.warrensbox.com/Troubleshoot/
3 - Add export PATH=$PATH:$HOME/.bin:$HOME/bin to your .bash_profile. This will make tfswitch and terraform commands available for you.
4 - OPTIONAL: Add following to your .bash_profile to preserve existing configurations such as colors.
if [ -f "${HOME}/.bashrc" ] ; then
@mranawake
mranawake / gist:14a5964b9e47f2370ab660cc2cf79e6c
Last active January 16, 2023 18:41
Run application as Windows admin on a lower environment with saved credentials. Create a shortcut and let it execute the command below with correct values.
runas /user:ComputerName\Username /savecred "C:\path\to\file.exe"
@mranawake
mranawake / snake_case.js
Created May 5, 2022 17:27
Snake case function to use as an app script extension on your Google Sheets.
/**
* Save this as an app script function on yout Google Sheets and start using it.
* Usage: =SNAKE_CASE(A1)
*/
function SNAKE_CASE(str) {
return str
.match(/[A-Z]{2,}(?=[A-Z][a-z0-9]*|\b)|[A-Z]?[a-z0-9]*|[A-Z]|[0-9]+/g)
.filter(Boolean)
.map(x => x.toLowerCase())
.join("_");
@mranawake
mranawake / mount.py
Last active June 1, 2020 00:02
AWS Lambda mounts Lambda Layers to /opt/nodejs/src and development source must be kept at /lib/<module_name>/nodejs. This causes problems with some IDEs not being able to find source to provide code hints. Above simple shell script will create symlinks to overcome this problem.
#!/usr/bin/python
import os
import glob
import sys
# variables
srcBase = "lib/nodejs/src/"
cwd = os.getcwd()
@mranawake
mranawake / random_things.txt
Last active January 4, 2021 01:56
Some random things to fix random things you encounter in life.
# Following should fix npm install errors like "stack Error: not found: make"
sudo apt-get install build-essential
# Elastic Beabstalk temp dployment folder
/tmp/deployment/application
# Elastic Beabstalk final dployment folder
/var/app/current
# Following will add /bin/node and /bin/npm symlinks to Beanstalk EC2 based on latest node installation available.
@mranawake
mranawake / move_all_files_folders.sh
Last active October 13, 2019 22:16
Move all files, folders and hidden files from one folder to another folder.
# set the dotglob shell optio if you want to move dot (hidden) files
shopt -s dotglob
# move all files, folders and hidden (if above option set) to a destination folder.
mv ~/source/* ~/destination
@mranawake
mranawake / idea.properties
Created September 4, 2019 14:39
Hide folder path and horizontal scrollbar from project screen in PHPStorm and WebStorm (this will probably work for other Jet Brains products). Go to Help > Edit Custom Properties and paste following values.
# custom PhpStorm properties
project.tree.structure.show.url=false
ide.tree.horizontal.default.autoscrolling=false
@mranawake
mranawake / webstorm_lambda_layer_path_resolve.js
Last active July 3, 2019 23:43
If you are using AWS Lambda Layers and using WebStorm as the IDE, probably your Layer's aren't being evaluated by the IDE due to incorrect paths. See below for a hack solution.
// Let's assume the "util.js" layer file is saved here: /lib/helpers/nodejs/util.js
// You will refer to the layer like below (according to AWS docs).
const Util = require('/opt/nodejs/src/util');
// Above will work, however WebStorm will give you annoying the "unresolved" warning
// and will not show the code completion. As a solution, create a symlink in your project
// to simulate the layer mount path. See below:
// ln -s lib/helpers opt
// MAJOR DOWNSIDE: This will only work for a single layer.
@mranawake
mranawake / find_amazon_linux_version.sh
Last active July 3, 2019 23:25
Few useful commands to find the Amazon Linux version on your EC2. Sometimes you need to know the version when installing 3rd party libraries.
cat /etc/system-release
# Amazon Linux release 2 (Karoo)
uname -a
# Linux ip-10-0-0-102.ec2.internal 4.14.101-91.76.amzn2.x86_64 #1 SMP Tue Feb 19 17:51:33 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
cat /etc/os-release
# NAME="Amazon Linux"
# VERSION="2"
# ID="amzn"