Skip to content

Instantly share code, notes, and snippets.

View alimbada's full-sized avatar

Ammaar Limbada alimbada

View GitHub Profile
@bradwilson
bradwilson / gist:2229275
Created March 28, 2012 18:41
Scorch PowerShell script for mixed Git/TFS environments
& taskkill /f /im msbuild.exe
if ((get-gitstatus) -ne $null) {
& git clean -xdf -e *.suo -e packages/*
} else {
& tfpt scorch . /recursive /deletes /diff /noprompt /exclude:"*.suo,.\packages"
}
@bzerangue
bzerangue / mac-trim-support-non-apple-ssd.markdown
Created June 25, 2012 02:39
Enabling TRIM Support on Mac OS X with Non-Apple SSDs

How To: Enable TRIM with Non-Apple SSD

The guide breaks the process down into three steps, all performed via copying and pasting the code snippets through the terminal window. To launch a terminal window, open the Utilities folder inside the Applications folder and select terminal.

The first step makes a backup of the original IOAHCIBlockStorage file called IOAHCIBlockStorage.original. You will be prompted to enter in your system password when using the "sudo" command, since you are modifying system files. Copy and paste the code into the terminal window, a successful or uneventful response is a new blank terminal line.

sudo cp /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage.original

Next the code patches the IOAHCIBlockStorage file, removing the requirements that the SSD be made by Apple. Copy and paste t

@mmdemirbas
mmdemirbas / LogFile.udl.xml
Created September 13, 2012 11:34
Custom log file syntax highlighting for Notepad++
<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>
@mariusGundersen
mariusGundersen / gist:6925246
Last active May 8, 2022 20:38
Programmer collective nouns
curl -u admin -k -d command=poweroff -d shutdown_option=1 -d OPERATION=set -d PAGE=System -d OUTER_TAB=tab_shutdown -d INNER_TAB=none https://{$1}/get_handler|awk -F"message>" '{print $2}'|awk -F"</" '{print $1}'
or
curl -u admin:netgear1 -k -d command=poweroff -d shutdown_option=1 -d OPERATION=set -d PAGE=System -d OUTER_TAB=tab_shutdown -d INNER_TAB=none https://10.20.0.102/get_handler
or
curl -u $user:$pass -k "https://$host/admin/index.cgi?CURRENTTAB=Shutdown&CURRENTPAGE=System&MODE=Advanced&button=Current&command=poweroff&MODIFIED=1" >/dev/null 2>/dev/null
@mikeminutillo
mikeminutillo / ProjectDependencies.cs
Created June 12, 2015 01:25
Get project dependency graph out using yuml.me and LINQPad
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();
@dvdsgl
dvdsgl / Monads for a C# dev.md
Last active January 8, 2024 06:11
Monads explained (sort of) to a C# developer

A monad is a fancy word for a generic type of the form MyMonad<T> (a generic type of arity 1).

A monad is special because it adds 'special powers' to the T that it wraps. These 'special powers' won't sound very special to an imperative programmer, so you have to squint to see them but bear with me.

  • IEnumerable<T> is a monad that gives values of type T the special power of nondeterminism, or the ability to 'be' multiple values at once.
  • Nullable<T> is a monad that gives values of type T the special power of nullability, or the ability to be absent.
  • Task<T> is a monad that gives values of type T the special power of asynchronicity, or the ability to be used before they are computed.

The trick with monads comes when you want to play with the T values, because they are inside another type. C# introduced language changes to make dealing with values inside these monads easier:

@braian87b
braian87b / relayd-igmpproxy.sh
Last active October 22, 2023 12:32
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
@yzgyyang
yzgyyang / FreeBSD_mount_img_files.md
Created June 28, 2017 20:46
FreeBSD mount img files

Determine the file system by using the file-utility.

file image.img

Use mdconfig to link the IMG image to a virtual device.

mdconfig -a -t vnode -f /path/to/image.img -u 0