Skip to content

Instantly share code, notes, and snippets.

View t1m0thyj's full-sized avatar

Timothy Johnson t1m0thyj

  • Pittsburgh, PA
  • 05:10 (UTC -04:00)
View GitHub Profile
@Schoggiweggli
Schoggiweggli / mojavewallpaper_WinMac.txt
Created October 26, 2018 19:42
mojavewallpaper_WinMac
10:40AM
Windows: image 3 - Mac: image 4
10:50AM / Windows switched
Windows: image 4 - Mac: image 4
11:40AM Mac switched
Windows: image 4 - Mac: image 5
11:45AM Windows switched
@Kazark
Kazark / Maybe.cs
Last active October 25, 2019 01:05
Maybe monad encoding in C#
class Nothing : Exception {}
public static class Maybe {
public static void Nothing() => throw new Nothing();
public static void Guard(bool cond) { if (!cond) Nothing(); }
public static void GuardNot(bool cond) { if (cond) Nothing(); }
}
public static class TryParse {
public static UInt32 UInt32(string x) {
@abdusco
abdusco / active_desktop.py
Last active May 29, 2021 01:03
Enable ActiveDesktop and set wallpaper with fade effect on Windows (tested on W10)
import ctypes
from win32com.shell import shell, shellcon
import pythoncom
def enable_active_desktop():
"""
Taken from:
https://stackoverflow.com/a/16351170
@jamesthompson
jamesthompson / install-stack-raspbian.sh
Created February 1, 2017 16:46
A script to install stack on Raspbian
#!/bin/sh
set +ex
# A script to install stack on Raspbian
# Use stack installer script to install stack
curl -sSL https://get.haskellstack.org/ | sh
# Use apt-get to install llvm
@olivertappin
olivertappin / create-large-file.sh
Last active March 7, 2023 06:36
Create a large file for testing
# Please note, the commands below will create unreadable files and should be
# used for testing file size only. If you're looking for something that has
# lines in it, use /dev/urandom instead of /dev/zero. You'll then be able to
# read the number of lines in that file using `wc -l large-file.1mb.txt`
# Create a 1MB file
dd if=/dev/zero of=large-file-1mb.txt count=1024 bs=1024
# Create a 10MB file
dd if=/dev/zero of=large-file-10mb.txt count=1024 bs=10240
@yamen
yamen / generate-certificate-chain.sh
Last active February 16, 2024 21:03
Generate a full self-signed certificate chain (Root -> Intermediate CA -> Server) using keytool, that can be used for 'localhost' development
#!/bin/bash
rm *.jks 2> /dev/null
rm *.pem 2> /dev/null
echo "===================================================="
echo "Creating fake third-party chain root -> ca"
echo "===================================================="
# generate private keys (for root and ca)
@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>
@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>"
/**
* This Google Sheets script keeps data in the specified column sorted any time
* the data changes.
*
* After much research, there wasn't an easy way to automatically keep a column
* sorted in Google Sheets, and creating a second sheet to act as a "view" to
* my primary one in order to achieve that was not an option. Instead, I
* created a script that watches for when a cell is edited and triggers
* an auto sort.
*
@milnak
milnak / ubuntu20-hyperv-enhanced-session.md
Last active April 24, 2024 20:24
[Enabling enhanced session in Hyper-V for Ubuntu 20] This works for me, although it seems that Hyper-V quick create now supports enhanced session by default. #ubuntu #hyperv

Setup Hyper-V enhanced session for Ubuntu 20

I couldn't find instructions that were 100% complete, so I put this together.

These instructions worked fine for me. Follow each step carefully.

Download Ubuntu 20 desktop

DO NOT create the VM by choosing Quick Create in Hyper-V Manager. Follow these instructions exactly.