Skip to content

Instantly share code, notes, and snippets.

View SupaMic's full-sized avatar

Michael Maloney SupaMic

  • SupaDesign
  • Victoria, BC
  • 07:27 (UTC -07:00)
View GitHub Profile
@SupaMic
SupaMic / delete_gitignored.bat
Last active January 26, 2024 00:53
Windows BAT file for deleting the files in a Git repo based on patterns in the .gitignore. This file is designed to be run in a parent directory with multiple Repo folders within it. Can run bat file with -y flag to Automatically confirm deletions but I'd recommend doing the Yes/No confirm for each file as the patterns can be unpredictable and n…
@echo off
setlocal enabledelayedexpansion
:: Check for '-y' argument
set "AUTO_CONFIRM=0"
if "%~1"=="-y" set "AUTO_CONFIRM=1"
:: Set the parent directory to the directory where the batch file is located
set "PARENT_DIR=%~dp0"
echo Parent Directory: %PARENT_DIR%
@SupaMic
SupaMic / .gitpod.ElixirDockerfile
Last active June 20, 2023 07:47
Elixir (for Phoenix w/ Postgres) Deployment on Gitpod using ASDF and Dockerfile
FROM gitpod/workspace-postgres
ENV DEBIAN_FRONTEND noninteractive
ENV ASDF_BRANCH v0.12.0
ENV ERLANG_V 25.2
ENV ELIXIR_V 1.14.2-otp-25
ENV KERL_BUILD_DOCS yes
USER root
# install dependencies here
@SupaMic
SupaMic / setup_swap.sh
Last active June 19, 2023 17:09
Swap file setup on Rocky 9
#!/bin/bash
# Digital Ocean Source: https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-rocky-linux-9
sudo fallocate -l 5G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo swapon --show
sudo cp /etc/fstab /etc/fstab.bak
@SupaMic
SupaMic / compiling.md
Last active May 24, 2023 22:36
Compiling NIFs on Windows

Compiling bcrypt_elixir or argon2_elixir on a Windows machine in 2022

I'm going outline the full process and what I can decipher is the reasoning behind each step of this process for successfully compiling the bcrypt_elixir or argon2_elixir dependencies on a Windows machine in the hopes that when inevitably Microsoft changes where and how they package build libraries, Elixir devs will have a better understanding when they try to troubleshoot.

The cause of all this headache is that bcrypt_elixir and argon2_elixir are actually just wrappers around C++ implementations of these password hashing algorithms implemented in NIFs (Native Implemented Functions). Some C++ NIF background [https://andrealeopardi.com/posts/using-c-from-elixir-with-nifs/] A peek at C code in the bcrypt_elixir repo [https://github.com/riverrun/bcrypt_elixir/tree/master/c_src]

Before I go ahead I want to implore the Elixir community to collaborate and build native implementations of these or similar password hashing algorithms because the

@SupaMic
SupaMic / rmEmail.js
Last active April 25, 2019 21:17
Delete all the emails in my Roundcube inbox javascript snippet
/****
Click on first email in list to highlight
then right click >> inspect element to dive into the iframe
then run this in the console
then you might need to click on the top email once in awhile or change the interval higher
*****/
function rmEmail(){
document.getElementById("messagelist").children[1].children[0].click();
document.getElementById("rcmbtn112").click();
@SupaMic
SupaMic / run-in-browser-console.js
Created February 7, 2019 00:41
Get the AWS IP Ranges for Cloud9 Servers which are needed to set inbound rules when connecting to outside servers by SSH
/* Might need to go to https://aws.amazon.com/ or use blank page to run */
var arr=[];
var oReq = new XMLHttpRequest();
oReq.addEventListener("load", reqListener);
oReq.open("GET", "https://ip-ranges.amazonaws.com/ip-ranges.json");
oReq.send();
function reqListener () {
JSON.parse(this.responseText).prefixes.map(function(obj){