Skip to content

Instantly share code, notes, and snippets.

View wmerfalen's full-sized avatar
⚒️
never stop

William Merfalen wmerfalen

⚒️
never stop
View GitHub Profile
@wmerfalen
wmerfalen / mit-license.txt
Last active October 23, 2021 05:43
MIT License template
/**
* Copyright (c) <YEAR> <YOUR NAME>
*
* 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
@wmerfalen
wmerfalen / rebase-strategy.md
Last active December 7, 2021 19:28
Rebase strategy

1) Get the most recent copy of master branch

git checkout master
git pull origin master

2) Rebase master onto your branch

@wmerfalen
wmerfalen / strategy.md
Created January 3, 2022 22:00
Git rebase strategy
  1. git checkout master
  2. git pull
  3. git checkout <your-branch>
  4. git rebase master
  5. deal with conflicts, if any. (If we keep getting multiple conflicts here then there's probably a problem)
  6. git push (--force normally only needed if there were conflicts or history changes)
  7. git checkout master
  8. git rebase <your-branch>
  9. git push (--force normally only needed if there were conflicts or history changes)
@wmerfalen
wmerfalen / .gitconfig
Created January 13, 2022 18:02
Secure .gitconfig for hiding email addresses in git log
[pretty]
secure = "%C(yellow)commit %H%n%C(white)Author: %an %nDate: %ad%n%n%w(0,4,4)%B%n"
[format]
pretty = secure
@wmerfalen
wmerfalen / var-const-let.md
Last active January 23, 2022 03:36
An objective look at `var`, `const`, and `let`.

Motivation

There are currently three ways to declare a variable in modern day Javascript. Each method has it's own reasons for why you would want to use them. What follows here is an objective look at each method of declaring a variable (or constant).

Scope

var

When the javascript engine encounters a var in code, it does what is known as hoisting. Let's first define what the english definition of hoisting

@wmerfalen
wmerfalen / .bashrc
Created February 4, 2022 22:24
Shortcut git commands
function parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
function gpo() {
# Usage: gpo this # pushes the currently checked out branch
# Usage: gpo main # pushes main
# Usage: gpo this --force [... any other git push flags here ...]
if [[ $1 -eq "this" ]]; then
B=$(parse_git_branch | cut -d'(' -f 2 | cut -d')' -f 1 | sort);
shift 1
@wmerfalen
wmerfalen / promise-sequence.js
Last active February 19, 2022 08:04
resolve a series of promises sequentially and in order
const messages = ['Good evening', 'Hey hows it goin?', 'Great', 'Cool', 'k, well, see ya!', 'late'];
async function sendMessage(msg){
console.log(`Sending message: "${msg}"...`);
await sleep(4000);
console.log(`msg(${msg}) sent!`);
}
(async () => {
await messages.reduce(async (previousPromise, message) => {
@wmerfalen
wmerfalen / asm-resources.md
Last active March 8, 2022 19:37
x86_64 assembler resources
#!/bin/bash
astyle -A2 -t -xn -xc -xl -xk -xV -C -xG -S -K -N -M80 -U -W1 -j --suffix=none $@
@wmerfalen
wmerfalen / pcap_exam.c
Created March 23, 2022 18:27 — forked from Taehun/pcap_exam.c
libpcap example code
#include <pcap.h>
#include <net/ethernet.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <netinet/tcp.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/types.h>