Skip to content

Instantly share code, notes, and snippets.

View andreasonny83's full-sized avatar
:octocat:
<Coding />

Andrea Z. andreasonny83

:octocat:
<Coding />
View GitHub Profile
@andreasonny83
andreasonny83 / .zshrc
Last active July 8, 2023 21:34
Auto switch Node Version with Nvm
find-nvmrc() {
local dir="$PWD"
while [[ "$dir" != "/" ]]; do
if [[ -f "$dir/.nvmrc" ]]; then
echo "$dir/.nvmrc"
return
fi
dir=$(dirname "$dir")
done
echo ""

Disable Device Enrollment Program (DEP) notification on macOS Monterey.md

NB! command-R is replaced with holding the power button on M1 macs.

With full reinstall (recommended)

   a. Boot into recovery using command-R during reboot, wipe the harddrive using Disk Utility, and select reinstall macOS

   b. Initial installation will run for approximately 1 hour, and reboot once

@andreasonny83
andreasonny83 / curl.md
Created September 24, 2020 15:18 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@andreasonny83
andreasonny83 / kali_osx_persistence_wifi.md
Created September 15, 2020 07:22 — forked from widdowquinn/kali_osx_persistence_wifi.md
Kali Linux Live USB with persistence and wireless on Macbook Pro

Kali Linux Bootable USB with Persistence and Wireless on OSX

Download the appropriate Kali Linux .iso

I used a 64 bit .iso image, downloaded via HTTP. I downloaded the amd64 weekly version, as the pool linux headers (needed below for installation of wireless drivers) were ahead of the stable release kernel.

Download the SHA256SUMS and SHA256SUMS.gpg files from the same location.

@andreasonny83
andreasonny83 / flatMap.js
Created September 21, 2019 10:10
Flat an array recursively
const _ = require('lodash');
const x = [1, [2, 3, 4, [5, 6]], 7];
const flat = (input) => Array.isArray(input) ? _.flatMap(input, item => flat(item)) : input;
const y = flat(x)
y // [1, 2, 3, 4, 5, 6, 7]
@andreasonny83
andreasonny83 / README.md
Created July 20, 2019 13:07
Run node app in background

Run node app in background

Running a script in the background in linux can be done using nohup, using nohup we can run node application in the background

$ nohup node server.js > /dev/null 2>&1 &
  • nohup means: Do not terminate this process even when the stty is cut off
  • &gt; /dev/null means: stdout goes to /dev/null (which is a dummy device that does not record any output)
@andreasonny83
andreasonny83 / RELEASE-NOTES.md
Last active May 3, 2024 11:36
Release Notes Template

Release Notes Template

Based off https://palantir.quip.com/pzRwAVr1bpzf

Pro-tip: look through the github diff between the previous release to see what's changed. The commit titles should give an outline of what's happened.

Upgrade Steps

  • List out, as concretely as possible, any steps users have to take when they upgrade beyond just dumping the dependency.
  • Write pseudocode that highlights what code should change and how.
@andreasonny83
andreasonny83 / top.md
Last active January 21, 2020 12:58
Background processes

ps aux | grep node

run top find the process id (PID) ps -efl | grep 10399 kill -9 10399

@andreasonny83
andreasonny83 / class-facade.js
Created February 17, 2019 22:09
Facade pattern
/**
* The Facade pattern simplifies and hides the underlying complexity of a large abody of
* code by providing a cleaner and easy to use interface.
*/
class TaskService {
constructor(data){
this.name = data.name;
this.priority = data.priority;
this.project = data.project;
@andreasonny83
andreasonny83 / class-factory.js
Last active February 17, 2019 22:13
Factory Pattern
/**
* The factory pattern abstracts object creation by providing an interface, where we can specify the type of
* factory object to be created.
*
* The Factory pattern can be especially useful when applied to the following situations:
*
* - When our object or component setup involves a high level of complexity,
* e.g. if it strongly depends on dynamic factors or application configuration.
* - When we need to easily generate different instances of objects depending on the environment we are in
* - When we're working with many small objects or components that share the same properties