Skip to content

Instantly share code, notes, and snippets.

View danielbayley's full-sized avatar

Daniel Bayley danielbayley

View GitHub Profile
@talkingmoose
talkingmoose / Download and Install Microsoft product.zsh
Last active September 4, 2025 16:31
**Download the latest version of this script from: https://gist.github.com/b6637160b65b751824943ede022daa17 .** Downloads and installs the latest available Microsoft product specified directly on the client. This avoids having to manually download and store an up-to-date installer on a distribution server every month.
#!/bin/zsh
:<<'ABOUT_THIS_SCRIPT'
-----------------------------------------------------------------------
Written by:William Smith
Partner Program Manager
Jamf
bill@talkingmoose.net
https://gist.github.com/b6637160b65b751824943ede022daa17
// per https://docs.npmjs.com/misc/scripts, npm exposes a bunch of variables to
// the environment prefixed with npm_config_*, npm_package_* and npm_lifecycle_*.
// Here's a list of all variables exposed in my setup.
npm_config_access=
npm_config_allow_same_version=
npm_config_also=
npm_config_always_auth=
npm_config_argv='{"remain":[],"cooked":["run","foo"],"original":["run","foo"]}'
npm_config_auth_type=legacy
@lucabertolasi
lucabertolasi / url-parser.js
Last active February 22, 2023 12:47
[JavaScript] A vanilla JS url parser.
/**
* @license
* Copyright (c) 2017, Luca Bertolasi. All Rights Reserved.
*
* This source code is licensed under the terms of the MIT license,
* a copy of which can be found at https://choosealicense.com/licenses/mit/
*/
function urlParser(url) {
// fallback to location object if no arg has been provided
@developit
developit / *state-machine-component.md
Last active February 6, 2021 00:44
265b lib for building pure functional state machine components. https://github.com/developit/state-machine-component

state-machine-component

A tiny (265 byte) utility to create state machine components using two pure functions.

🔥 JSFiddle Demo

Usage

The API is a single function that accepts 2 pure functions as arguments:

@elvisizer
elvisizer / gist:2dfa119e959ae6f35389d4d56054f067
Last active June 5, 2022 13:46
High Sierra firmware updates outside of the OS installer.app
Procedure followed by Pepijn to run the high sierra firmware installer:
1. get the FirmwareUpdate.pkg file from the OS installer app's installESD.dmg
2. extract the contents using pkgutil --expand /path/to/FirmwareUpdate.pkg <path somewhere else>/FirmwareUpdate
3. in terminal, cd to the Scripts directory inside the expanded FirmwareUpdate pkg directory.
4. with Scripts as your working directory, run these 2 commands, then reboot:
sudo /usr/libexec/FirmwareUpdateLauncher -p "$PWD/Tools"
sudo /usr/libexec/efiupdater -p "$PWD/Tools/EFIPayloads"
5. at the reboot, firmware will be updated if there are any updates to be applied.
@juanarbol
juanarbol / chmodCheatSheet.md
Last active February 18, 2026 12:19
Chmod cheat sheet

Chmod codes cheat sheet

How to use chmod codes in UNIX:

  1. There are three types of permissions in files and folders in unix
    1. Read (r)
    2. Write (w)
    3. Execute (x)
  2. And, there is a classification of users called UGO (explained bellow):
  3. U ~> User (usually, you)
@radekk
radekk / detect.malicious.npm.sh
Last active April 27, 2020 04:43
Detect malicious npm packages published by ~hacktask account
#!/bin/bash
# Author: @radekk
# List of vulnerable packages is from https://twitter.com/iamakulov/status/892485192883073024
# ----------------------
_IFS=$IFS
_COUNTER=0
_COUNTER_ALL=0
_SCAN_PATH=${1:-~/}
_VULN_PACKAGES="babelcli crossenv cross-env.js d3.js fabric-js ffmepg gruntcli http-proxy.js jquery.js mariadb mongose mssql.js mssql-node mysqljs nodecaffe nodefabric node-fabric nodeffmpeg nodemailer-js nodemailer.js nodemssql node-opencv node-opensl node-openssl noderequest nodesass nodesqlite node-sqlite node-tkinter opencv.js openssl.js proxy.js shadowsock smb sqlite.js sqliter sqlserver tkinter"
_REGEXP="(babelcli|crossenv|cross-env\.js|d3\.js|fabric-js|ffmepg|gruntcli|http-proxy\.js|jquery\.js|mariadb|mongose|mssql\.js|nodecaffe|nodefabric|node-fabric|nodeffmpeg|nodemailer-js|nodemailer\.js|nodemssql|node-opencv|node-opensl|node-openssl|noderequest|nodesass|nodesqlite|node-sqlite|node-tkinter|opencv\.js|openssl\.js|proxy\.js|shadowsock|smb|sqlite\.js|sqliter|sqlserver|tkinter)"
@JBlond
JBlond / bash-colors.md
Last active March 30, 2026 15:24 — forked from iamnewton/bash-colors.md
The entire table of ANSI color codes.

Regular Colors

Value Color
\e[0;30m Black
\e[0;31m Red
\e[0;32m Green
\e[0;33m Yellow
\e[0;34m Blue
\e[0;35m Purple
@SKempin
SKempin / Git Subtree basics.md
Last active March 8, 2026 20:56
Git Subtree basics

Git Subtree Basics

If you hate git submodule, then you may want to give git subtree a try.

Background

When you want to use a subtree, you add the subtree to an existing repository where the subtree is a reference to another repository url and branch/tag. This add command adds all the code and files into the main repository locally; it's not just a reference to a remote repo.

When you stage and commit files for the main repo, it will add all of the remote files in the same operation. The subtree checkout will pull all the files in one pass, so there is no need to try and connect to another repo to get the portion of subtree files, because they were already included in the main repo.

Adding a subtree

Let's say you already have a git repository with at least one commit. You can add another repository into this respository like this:

@tanepiper
tanepiper / index.js
Last active September 23, 2025 18:13
#!/usr/bin/env node
const fs = require('fs');
const http = require('http');
const home = process.env.HOME;
const options = {
host: 'example.com',
path: '/',