This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![allow(dead_code)] | |
use std::{env::current_dir, fs}; | |
use nom::{IResult, bytes::complete::{tag, take_until, take_while1}, branch::alt, multi::separated_list0}; | |
pub fn main() -> color_eyre::Result<()> { | |
let pwd = current_dir()?; | |
let input = fs::read_to_string(pwd.join("input/y2023/d02.txt"))?; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 2>NUL & @CLS & PUSHD "%~dp0" & "%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -nol -nop -ep bypass "[IO.File]::ReadAllText('%~f0')|iex" & POPD & EXIT /B | |
<# | |
@ | |
Stops a command from echoing to the console host. | |
# 2>NUL & @CLS | |
This allows us to comment out the batch wrapper part from the powershell script and eats the cmd.exe error since # is not a command or control character. | |
PUSHD "%~dp0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A_SCRIPT_CAPS = ord("\N{MATHEMATICAL BOLD SCRIPT CAPITAL A}") | |
A_SCRIPT_SMALL = ord("\N{MATHEMATICAL BOLD SCRIPT SMALL A}") | |
A_CAPS = ord('A') | |
A_SMALL = ord('a') | |
RANGE_CAPS = range(A_CAPS, A_CAPS+26) | |
RANGE_SMALL = range(A_SMALL, A_SMALL+26) | |
def cursive(s: str) -> str: | |
for i, v in enumerate(chars := list(map(ord, s))): | |
if v in RANGE_CAPS: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @noframes | |
// @name giphy-reddit | |
// @namespace mburszley | |
// @description Creates a button to copy Reddit markdown to clipboard from Giphy for embedding gifs in Reddit comments. | |
// @grant clipboardWrite | |
// @match https://giphy.com/* | |
// @version 6 | |
// @downloadURL https://gist.github.com/mburszley/1474687f8447495b3ea724c9ea97bebb/raw/giphy-reddit.user.js | |
// @updateURL https://gist.github.com/mburszley/1474687f8447495b3ea724c9ea97bebb/raw/giphy-reddit.user.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
// To view the default settings, hold "alt" while clicking on the "Settings" button. | |
// For documentation on these settings, see: https://aka.ms/terminal-documentation | |
{ | |
"$schema": "https://aka.ms/terminal-profiles-schema", | |
"defaultProfile": "{574e775e-4f2a-5b96-ac1e-a2962a402336}", | |
"confirmCloseAllTabs": false, | |
"requestedTheme": "dark", | |
"wordDelimiters": " _/\\()\"'-.,:;<>~!@#$%^&*|+=[]{}~?\u2502", | |
"profiles": { | |
"defaults": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://editorconfig.org/#supported-properties | |
# https://docs.microsoft.com/en-us/visualstudio/ide/create-portable-custom-editor-options?view=vs-2017#supported-settings | |
root = true | |
[*] | |
indent_style = space | |
indent_size = 4 | |
end_of_line = lf | |
charset = utf-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#header { | |
position: fixed; | |
width: 100vw; | |
top: 0; | |
} | |
.content { | |
margin-top: 70px; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function prompt { | |
@" | |
`e[38;2;148;152;0m`n{0} | |
`e[m/{1}/ | |
`e[38;5;21mPS `e[m`e[1m`e[4m {2} `e[m `e[38;5;208m{3}`e[38;5;92m{4} `e[m | |
"@ -f @((Get-Date -UFormat '%Y-%m-%d %H:%M:%S') | |
$PWD.Drive.Name.ToUpper() | |
((Get-History).Count + 1).ToString('000') | |
($PWD.ProviderPath.ToLower().Replace($HOME, '~').Replace('\', '/') -replace '\w:' -replace '/$') + '/' | |
'>' * ($NestedPromptLevel + 1)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#TODO: Add support for URIs | |
function Convert-ImageToAscii { | |
[Alias('i2a')] | |
[OutputType([string])] | |
[CmdletBinding()] | |
param( | |
[Parameter(Mandatory, Position = 0, ValueFromPipeline)] | |
[ValidateScript({ $PSItem.Exists -and | |
$PSItem.Extension -in '.bmp', '.gif', '.jpeg', '.jpg', '.png', '.tiff' })] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"update.enableWindowsBackgroundUpdates": true, | |
"update.mode": "default", | |
"update.showReleaseNotes": false, | |
"telemetry.enableCrashReporter": false, | |
"telemetry.enableTelemetry": false, | |
"powershell.codeFolding.enable": true, | |
"powershell.codeFolding.showLastLine": false, |
NewerOlder