Skip to content

Instantly share code, notes, and snippets.

View alexyorke's full-sized avatar

Alex Yorke alexyorke

View GitHub Profile
@alexyorke
alexyorke / npmjs-explore.user.js
Last active April 6, 2021 21:22 — forked from notpushkin/npmjs-explore.user.js
Redirect from npm's Explore link to https://unpkg.com/browse/*/, which is available for all ✨
// ==UserScript==
// @name npmjs.com Explore → unpkg.com Browse
// @author Alex Yorke (credits to Alexander Pushkov <alexander@notpushk.in>)
// @version 2
// @grant none
// @include https://npmjs.com/package/*
// @include https://www.npmjs.com/package/*
// ==/UserScript==
const oldExploreLink = document.querySelector('a[href="?activeTab=explore"]');
If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole(`
[Security.Principal.WindowsBuiltInRole] "Administrator"))
{
Write-Warning "You do not have Administrator rights to run this script!`nPlease re-run this script as an Administrator!"
Break
}
Write-Host "Excluding appdata NPM folder and Node.JS install folder from Windows Defender."
Add-MpPreference -ExclusionPath ([System.Environment]::ExpandEnvironmentVariables("%APPDATA%\npm\"))
Add-MpPreference -ExclusionPath (Get-ItemProperty "HKLM:SOFTWARE\Node.js" | Select-Object -Property InstallPath)
#!/bin/sh
MINGW=true
REPO_NAME="Orbital"
ORG_NAME="focisolutions"
if [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
if ! [ -x "$(command -v xclip)" ]; then
echo 'Please install xclip via apt install xclip' >&2
exit 1
fi
@alexyorke
alexyorke / add_node_vs_code_studio_exceptions.ps1
Last active January 29, 2020 18:37 — forked from darvell/add_node_exceptions.ps1
Adds useful exceptions to Windows Defender for node.js developers. MUST BE RUN as an administrator
If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole(`
[Security.Principal.WindowsBuiltInRole] "Administrator"))
{
Write-Warning "You do not have Administrator rights to run this script!`nPlease re-run this script as an Administrator!"
Break
}
Write-Host "Excluding appdata NPM folder and Node.JS install folder from Windows Defender."
Add-MpPreference -ExclusionPath ([System.Environment]::ExpandEnvironmentVariables("%APPDATA%\npm\"))
Add-MpPreference -ExclusionPath (Get-ItemProperty "HKLM:SOFTWARE\Node.js" | Select-Object -Property InstallPath)
Please see https://github.com/Decagon/hn-sonar for the new enhanced version.
@alexyorke
alexyorke / ssd-protect.bash
Created December 31, 2016 03:07
Tracks how much data is written to your SSD everyday to prevent over-wearing and helps locate misbehaving apps
# grep for your hd (e.g. sda1) assumes 512kb blocks
# based on http://serverfault.com/questions/238033/measuring-total-bytes-written-under-linux
stat=$( awk '/sd/ {print $3"\t"$10 / 2 / 1024}' /proc/diskstats | sed 's/\s\+/ /g' | grep sda1 )
mbWritten=$(echo $stat | cut -d " " -f 2)
echo "Megabytes written (all time): $mbWritten"
# exercise for the reader: save value to file, and compare it to tomorrow to see how many mb's were written
ffprobe -v quiet -show_format -show_streams /path/to/video/file | grep -F "start_time" | sort | uniq | cut -d "=" -f 2