Skip to content

Instantly share code, notes, and snippets.

@don-smith
don-smith / swap-caps-lock-and-ctrl.ps1
Last active April 20, 2024 11:44
A PowerShell script to swap the Caps Lock and Ctrl keys
# Script found at https://superuser.com/a/997448
# Swap details found at https://www.mavjs.org/post/swap-ctrl-and-capslock-on-windows
# Improvement provided by Davido264 in comment below
$hexified = "00,00,00,00,00,00,00,00,03,00,00,00,1d,00,3a,00,3a,00,1d,00".Split(',') | % { "0x$_"};
$kbLayout = 'HKLM:\System\CurrentControlSet\Control\Keyboard Layout';
$scancodeMap = Get-ItemProperty -Path $kbLayout -Name "Scancode Map" -ErrorAction Ignore
if ( -not $scancodeMap )
{
@Drarig29
Drarig29 / better-git-checkout.sh
Last active April 20, 2024 11:43
Git checkout with fuzzy search and automatic branch swap between worktrees
function swap_worktree_branch_with() {
# Run the command again to get the error message
error_message=$(git switch $1 2>&1)
culprit_worktree=$(echo $error_message | grep "is already used by worktree at" | cut -d "'" -f4)
if [ -z "$culprit_worktree" ]; then
return
fi
# Save the branch in current worktree, and detach the HEAD so that we can switch to this branch in the culprit worktree
@adrianhajdin
adrianhajdin / index.css
Created November 11, 2021 13:19
Build and Deploy a Fully Responsive Website with Modern UI/UX in React JS
.gpt3__whatgpt3 {
display: flex;
flex-direction: column;
padding: 2rem;
background: var(--color-footer);
/* ff 3.6+ */
background:-moz-radial-gradient(circle at 30% -100%, #042c54 25%, rgba(4, 44, 84, 1) 85%, rgba(27, 120, 222, 1) 100%);
@andyjessop
andyjessop / prompt.txt
Created April 20, 2024 07:43
A prompt to categorise and analyse sentiment for GitHub issues
Please analyze the following GitHub issue data, which is provided as a JSON object:
{
"title": "🐛 BUG: WebSocket typing doesn't work in apps that also pull in DOM types",
"body": "Which Cloudflare product(s) does this pertain to?",
}
Provide a response with the following structure:
<json>
@anditriathlon
anditriathlon / polar_flow_bulk_export.md
Last active April 20, 2024 11:39
Polar Flow export multiple activities in one go using JS/jQuery - working solution at 2023-08-18 using Google Chrome
  1. First of all navigate to: https://flow.polar.com/diary/training-list and select the date range of activities you want, and pick show all in drop down.

  2. then open the developer tools in your browser, e.g in Google Chrome "Control + Alt + I" on Windows or "Option + Command + I" on Mac

  3. then copy paste below JS into console

function extractActivityIds () {
@tomasdev
tomasdev / minecraft-emoji.md
Last active April 20, 2024 11:38
Minecraft allowed emojis

Minecraft allowed emojis

Ever wondered how to insert emoji in minecraft? Well turns out Minecraft supports only a subset of emoji (old one) but you can copy-paste these in it!

Screenshot of the emojis being rendered in Minecraft

These also look great on signs!

Minecraft sign with glowing effect showcasing arrows

@trusktr
trusktr / DefaultKeyBinding.dict
Last active April 20, 2024 11:37
My DefaultKeyBinding.dict for Mac OS X
/* ~/Library/KeyBindings/DefaultKeyBinding.Dict
This file remaps the key bindings of a single user on Mac OS X 10.5 to more
closely match default behavior on Windows systems. This makes the Command key
behave like Windows Control key. To use Control instead of Command, either swap
Control and Command in Apple->System Preferences->Keyboard->Modifier Keys...
or replace @ with ^ in this file.
Here is a rough cheatsheet for syntax.
Key Modifiers
@anupambhatnagar
anupambhatnagar / profiler.py
Created December 14, 2023 01:14
Trace collection example
import torch
import torch.nn as nn
import torch.optim as optim
from torch.profiler import profile, schedule, tensorboard_trace_handler, ProfilerActivity
class Xor(nn.Module):
def __init__(self):
super(Xor, self).__init__()
self.fc1 = nn.Linear(2, 3, True)
self.fc2 = nn.Linear(3, 1, True)