Skip to content

Instantly share code, notes, and snippets.

View alimbada's full-sized avatar

Ammaar Limbada alimbada

View GitHub Profile
@alimbada
alimbada / Export-Chocolatey.ps1
Last active April 21, 2024 11:39
Export installed Chocolatey packages as packages.config - thanks to Matty666
#Put this in Export-Chocolatey.ps1 file and run it:
#.\Export-Chocolatey.ps1 > packages.config
#You can install the packages using
#choco install packages.config -y
Write-Output "<?xml version=`"1.0`" encoding=`"utf-8`"?>"
Write-Output "<packages>"
choco list -lo -r -y | % { " <package id=`"$($_.SubString(0, $_.IndexOf("|")))`" version=`"$($_.SubString($_.IndexOf("|") + 1))`" />" }
Write-Output "</packages>"
@alimbada
alimbada / UnlockScreen.cmd
Created May 16, 2015 14:20
Unlocks the screen on a remote Windows machine (so that I can stream games from it with Steam In-Home Streaming)
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "$sessionid=((quser $env:USERNAME | select -Skip 1) -split '\s+')[2]; tscon $sessionid /dest:console" 2> UnlockErrors.log
void Main()
{
var ignores = new Regex[]
{
new Regex(@"Approval"),
new Regex(@"Test"),
new Regex(@"Demo")
};
var serviceControl = @"C:\Code\Particular\ServiceControl\src\";
Util.Image("http://yuml.me/diagram/scruffy;scale:150/class/" + String.Join(",", GetDependencies(serviceControl, ignores))).Dump();
<NotepadPlus>
<UserLang name="LogFile" ext="log">
<Settings>
<Global caseIgnored="yes" />
<TreatAsSymbol comment="no" commentLine="no" />
<Prefix words1="no" words2="no" words3="no" words4="no" />
</Settings>
<KeywordLists>
<Keywords name="Delimiters">[(0])0</Keywords>
<Keywords name="Folder+"></Keywords>
@alimbada
alimbada / mkv-subtitle-track.sh
Last active October 11, 2018 15:31
Gets subtitle track number from an MKV file
ffprobe -hide_banner -i $mkvFile 2>&1 | grep -i subtitle | awk '{print $2}' | awk -F':' '{ print substr($2,1,1) }'
@alimbada
alimbada / mkv-extract-subtitles.sh
Last active April 29, 2022 07:07
Use mkvextract to extract subtitles from a directory of MKV files into SRT files
# Subtitle track number is usually the same for a whole series and usually for all encodes from a specific place
# Use this first to ascertain the track number
# find . -iname '*.mkv' -maxdepth 1 -exec sh -c "ffprobe -hide_banner -i '{}' 2>&1 | grep Subtitle | cut -d':' -f2 | cut -d'(' -f1 " \;
find . -iname '*.mkv' -maxdepth 1 -exec basename {} .mkv \; | xargs -I {} mkvextract tracks '{}.mkv' ${SUBTITLE_TRACK_NUMBER}:'{}.srt'
@alimbada
alimbada / relayd-igmpproxy.sh
Created October 31, 2018 13:38 — forked from braian87b/relayd-igmpproxy.sh
How to setup Client Bridged / Client Mode / RelayD and IGMPProxy for OpenWRT / LEDE
# Client Bridged / Client Mode / RelayD and IGMPProxy (It works)
# RelayD is to redirect packages and IGMP is for redirect IGMP packages
# Our network is 192.168.1.0/24
# Steps:
# Configure WAN as static
# We should edit our wan iface and put static IP
uci set network.wan='interface'
uci set network.wan.proto='static'
uci set network.wan.ipaddr='192.168.1.239' # Main Network IP
@alimbada
alimbada / Empty Standby List Scheduled Task.xml
Last active August 23, 2019 16:22
Empty Standby List Scheduled Task
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Date>2019-08-22T13:32:01.0996741</Date>
<Author>.\Ammaar.Limbada</Author>
<URI>\Ammaar.Limbada\Empty Standby List Scheduled Task</URI>
</RegistrationInfo>
<Triggers>
<TimeTrigger>
<Repetition>
@alimbada
alimbada / Kill App Scheduled Task.xml
Last active September 30, 2019 11:52
Scheduled Task for Reacting to Process Creation Event
<?xml version="1.0" encoding="UTF-16"?>
<!--
Pre-requisites: (see https://superuser.com/questions/745318/how-to-start-a-program-when-another-one-is-started)
Start and enter secpol.msc into the Run box
Navigate to Local Policies/Audit Policy
Double Click Audit process tracking and enable Success
-->
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Date>2019-09-30T12:39:02.4100122</Date>
@alimbada
alimbada / revert-typechanges.sh
Created February 19, 2020 11:51
Revert git typechanges
git status --porcelain=2 | awk '{if($2==".T") {print "git checkout " $NF}}' | sh