Skip to content

Instantly share code, notes, and snippets.

View spronkey's full-sized avatar

Keith Humm spronkey

  • Solvam Corporation Ltd
  • Christchurch, New Zealand
View GitHub Profile
@quinncomendant
quinncomendant / cpu-threshold-alert-microsoft-edge
Last active September 18, 2022 14:40
Detect if Microsoft Edge has been using more than 90% CPU continuously.
#!/usr/bin/env bash
# Microsoft Edge on macOS sometimes will get stuck using 100% CPU endlessly, requiring a relaunch to stop.
# See issue at https://techcommunity.microsoft.com/t5/discussions/edge-browser-100-cpu-requires-force-quit-macos-mojave-and-v91-0/m-p/2441462/highlight/true#M48074
#
# This script will display a macOS notification if Microsoft Edge has been using more
# than 90% CPU continuously for more than 10 minutes. It only checks the main
# Microsoft Edge process, not the Microsoft Edge Helper processes.
#
# Save it to ~/bin/cpu-threshold-alert-microsoft-edge
@navin-mohan
navin-mohan / harden-ssh.sh
Last active December 31, 2023 12:01
A script to harden openSSH on ubuntu or debian server
#!/bin/bash
# Script to harden ssh on ubuntu/debian server
# follow on my blog http://www.coderew.com/hardening_ssh_on_remote_ubuntu_debian_server/
# checkout the repo for more scripts https://github.com/nvnmo/handy-scripts
read -p "Enter your server IP:" serverIP # prompt for server IP
read -p "Enter your username(requires root privileges):" username # prompt for username
printf "\nChanging the default SSH port is one of the easiest\n things you can do to help harden you servers security. \nIt will protect you from robots that are programmed \nto scan for port 22 openings, and commence \ntheir attack."
printf "\n"
read -p "Do you want to change default SSH port?[Y/n]" -n 1 portChange
@branneman
branneman / better-nodejs-require-paths.md
Last active April 8, 2024 00:22
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@jseidl
jseidl / curlopt_codes.txt
Created July 31, 2012 17:19
CURLOPT codes
CURLOPT_NOTHING = 0;
CURLOPT_FILE = 10001;
CURLOPT_URL = 10002;
CURLOPT_PORT = 3;
CURLOPT_PROXY = 10004;
CURLOPT_USERPWD = 10005;
CURLOPT_PROXYUSERPWD = 10006;
CURLOPT_RANGE = 10007;
CURLOPT_INFILE = 10009;
CURLOPT_ERRORBUFFER = 10010;