Skip to content

Instantly share code, notes, and snippets.

View vintagesucks's full-sized avatar

Nikolas Evers vintagesucks

View GitHub Profile
@vintagesucks
vintagesucks / mergeswm.ps1
Created August 30, 2022 17:38 — forked from JunielKatarn/mergeswm.ps1
Correct way to merge SWM files into a WIM file. TechNet documentation is wrong for this command.
# Taken from https://technet.microsoft.com/en-us/library/hh825258.aspx
Param
(
$ImageName
)
dism /Export-Image `
/SourceImageFile:${ImageName}.swm `
/SWMFile:${ImageName}*.swm `
/SourceIndex:1 `
@vintagesucks
vintagesucks / install-pre-commit.sh
Last active July 22, 2020 10:50 — forked from stefansundin/install-pre-push.sh
Git pre-commit hook to prevent commits to the local master branch.
#!/bin/sh
# This script will install a Git pre-commit hook that prevents commits to the local master branch.
# Single repo installation:
# curl -fL https://gist.github.com/vintagesucks/b6d8cd37a88e8e9eeef9ebe92f1c2dd9/raw/install-pre-commit.sh | sh
# Uninstall:
# rm .git/hooks/pre-commit
GIT_DIR=`git rev-parse --git-common-dir 2> /dev/null`
We couldn’t find that file to show.
@vintagesucks
vintagesucks / alexa.js
Last active April 24, 2018 11:15 — forked from chilts/alexa.js
Getting the Alexa top 1 million sites directly from the server, unzipping it, parsing the csv and writing each entry to a text file
var request = require('request');
var unzip = require('unzip');
var csv2 = require('csv2');
var fs = require('fs');
var wstream = fs.createWriteStream('alexa.txt');
request.get('http://s3.amazonaws.com/alexa-static/top-1m.csv.zip')
.pipe(unzip.Parse())
.on('entry', function (entry) {
entry.pipe(csv2()).on('data', function (data) {
@vintagesucks
vintagesucks / _blank.min.js
Last active December 2, 2017 06:38 — forked from CrocoDillon/_blank.js
Automatically open external links in new tab or window.
for(var links=document.links,i=0,linksLength=links.length;i<linksLength;i++)links[i].hostname!=window.location.hostname&&(links[i].target="_blank");
#!/bin/sh
#https://getcomposer.org/doc/faqs/how-to-install-composer-programmatically.md
EXPECTED_SIGNATURE=$(wget -q -O - https://composer.github.io/installer.sig)
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
ACTUAL_SIGNATURE=$(php -r "echo hash_file('SHA384', 'composer-setup.php');")
if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ]
then
>&2 echo 'ERROR: Invalid installer signature'
@vintagesucks
vintagesucks / windows-version.bat
Created August 29, 2016 15:24
.bat file to display current Windows version, release branch and build number
:: Author: Nikolas Evers
:: GitHub: https://github.com/vintagesucks
:: About: .bat file to display current Windows version, release branch and build number in PowerShell
start powershell.exe -noexit -Command "Write-Host Product: (((Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion' -Name ProductName).ProductName)) `nBranch:`t(((Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion' -Name BuildBranch).BuildBranch))`nBuild:`t(((Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion' -Name CurrentBuild).CurrentBuild))"