Skip to content

Instantly share code, notes, and snippets.

Eric Bailey nerflad

View GitHub Profile
@nerflad
nerflad / AlternativeFacts.vim
Last active Feb 7, 2017
Swap boolean truthiness keywords using increment/decrement keys
View AlternativeFacts.vim
function ProvideAlternativeFacts()
if expand('<cword>') == "True"
execute "normal! ciwFalse"
elseif expand('<cword>') == "False"
execute "normal! ciwTrue"
endif
endfunction
nnoremap <c-a> :call ProvideAlternativeFacts()<CR><C-a>
nnoremap <c-x> :call ProvideAlternativeFacts()<CR><C-x>
View fix-gnome-window-controls.sh
#!/bin/sh
gsettings set org.gnome.desktop.wm.preferences button-layout 'close,minimize,maximize:'
@nerflad
nerflad / constructuloidulous.py
Last active Jan 18, 2017
Simple example class in Python to demonstrate a constructor to a friend
View constructuloidulous.py
class Person(object):
alive = True
def __init__(self, name, height):
self.name = name
self.height = height
def sayname(self):
print("Hi, name is ", self.name, " and I am ", self.height, " feet tall!")
@nerflad
nerflad / reclaimWindows10.ps1
Created Jan 8, 2017 — forked from alirobe/reclaimWindows10.ps1
"Reclaim Windows 10" turns off a bunch of unnecessary Windows 10 telemetery, removes bloatware, and privacy invasions. Review and tweak before running. Scripts for reversing are included and commented. Fork via https://github.com/Disassembler0 (different defaults)
View reclaimWindows10.ps1
##########
# Win10 Initial Setup Script
# Author: Disassembler <disassembler@dasm.cz>
# Version: 1.7, 2016-08-15
# dasm's script: https://github.com/Disassembler0/Win10-Initial-Setup-Script/
# THIS IS A PERSONALIZED VERSION
# This script leaves more MS defaults on, including MS security features.
# Tweaked based on personal preferences for @alirobe 2016-11-16 - v1.7.1
@nerflad
nerflad / keybase.md
Created Jan 6, 2017
verifying meself...
View keybase.md

Keybase proof

I hereby claim:

  • I am nerflad on github.
  • I am nerflad (https://keybase.io/nerflad) on keybase.
  • I have a public key ASBE5NCN6npxKEnnUgcgzM9q6-lBTBH7JoJpYnEC0X9Eigo

To claim this, I am signing this object:

View pull-all-in-local.fish
#!/usr/bin/fish
set currentbranch (git branch | awk '{print $2}' | grep -v -e '^$');
set otherbranches (git branch | awk '{print $1}' | grep -v -e '\*');
git pull;
for i in $otherbranches
git checkout $i
@nerflad
nerflad / deleteself.bat
Created Jul 14, 2016
Self Deleting Batch Script
View deleteself.bat
:: Delete self, handy for scripts you need manually
:: copy and deploy to lots of machines
:: Pretty sure I stole this from SS64.
set "batchPath=%~0"
echo Set objFSO = CreateObject( "Scripting.FileSystemObject" ) > "%~dp0temp.vbs"
echo objFSO.DeleteFile( "!batchPath!" ) >> "%~dp0temp.vbs"
echo objFSO.DeleteFile WScript.ScriptFullName >> "%~dp0temp.vbs"
echo WScript.Quit >> "%~dp0temp.vbs"
"%~dp0temp.vbs
@nerflad
nerflad / readCfgs.bat
Created Jul 2, 2016
Read all .cfg files in cwd with nested FOR loop
View readCfgs.bat
@echo off
:readCfgs
for %%A in (%~dp0*.cfg) do (
for /f %%B in (%%A) do (
set "varName=%%~nA"
set "!varName!="
set "!varName!=%%B"
)
)
goto :EOF
@nerflad
nerflad / get-wmic-time.bat
Created Jul 2, 2016
Windows: Get fancy formatted time from WMIC if you don't have access to Command Extensions (for native %date% and %time%)
View get-wmic-time.bat
:: This is not mine!
:: This is almost verbatim from an answer on stack exchange!
@echo off
setlocal EnableDelayedExpansion
setlocal
:getTime
for /f "tokens=2 delims==" %%a in ('wmic OS Get localdatetime /value') do (
set "dt=%%a"
@nerflad
nerflad / gpExtract.bat
Created Jul 1, 2016
Windows: backup Local Group Policy to directory
View gpExtract.bat
:: Requires Administrator
:: Copies entire GP object directory from system32 to current working directory
@echo off
setlocal EnableExtensions
setlocal
set "dirname=.\policyobjects - %DATE% %TIME%"
takeown /a /f %systemroot%\system32\grouppolicy /r /d y
xcopy %systemroot%\system32\grouppolicy "%dirname%" /s /h /i /y
You can’t perform that action at this time.