Skip to content

Instantly share code, notes, and snippets.

Two pointers: one input, opposite ends
```python3
def fn(arr):
left = ans = 0
right = len(arr) - 1
while left < right:
# do some logic here with left and right
if CONDITION:
@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)
@dahaha-365
dahaha-365 / lazy_script.js
Last active July 6, 2025 01:29
Clash Verge Rev 全局扩展脚本(懒人脚本配置)
/***
* Clash Verge Rev 全局扩展脚本(懒人配置)/ Mihomo Party 覆写脚本
* URL: https://gist.github.com/dahaha-365/0b8beb613f8d1ee656fe1f21e1a07959
*/
/**
* 整个脚本的总开关,在Mihomo Party使用的话,请保持为true
* true = 启用
* false = 禁用
*/
//
// ContentView.swift
// RigelianTagger
//
// Created by Berrie Kremers on 05/03/2022.
//
// This shows how a directory structure can be shown in a sidebar, with dynamic loading
// of additional content as the user drills down in the hierarchy.
//
@jackblk
jackblk / LogitechF310_Macbook.MD
Created April 13, 2021 16:07
Getting Logitech F310 to work with Macbook USB-C port

Connect & use Logitech F310 with Macbook

Since my Macbook Pro only has USB-C port, I used an USB-A to USB-C adapter to connect my F310 to it, but it does not work (pressing MODE button does not turn on the LED).

How to

To make it work:

  • Disconnect F310 from Mac
  • On F310: switch X-input to D-input
  • Hold Logitech button (in the middle)
  • Connect F310 to Mac via adapter, now you can release the Logitech button.
@ghouston
ghouston / talon.parrot.md
Last active July 6, 2025 01:21
How to setup parrot.py to work with talon

How to setup parrot.py to work with talon

updated: 2024-03-21

Parrot.py integration enables you to make noises such as pops, clicks, and hiss sounds which trigger Talon actions. Any sound which is not part of normal speech can be used, even non-human sounds such as a bell can work.

Prereq: requires the beta tier of Talon Voice which is a paid tier via patreon at lunixbochs.

If you have trouble, the best place for help is on slack talonvoice.slack.com in the #ext-parrot channel.

Helpful video tutorials are found on youtube. These videos are slightly outdated because the current parrot.py has a newer display. (Thanks Pokey Rule, I would have never figured this out without your videos getting me started on the right track!)

# Context Network Retrospective Agent Prompt
## Task Context
You are conducting a retrospective analysis after completing a task. Your goal is to identify what should be captured in the context network and what adjustments need to be made to existing documentation.
## Critical Domain Boundary Reminder
Remember the distinction:
- **Context Network**: Planning documents, architecture decisions, design discussions, implementation strategies
@seachai
seachai / gist:948ed1eeafa32ce03db6685edb879f71
Last active July 6, 2025 01:10
iTerm 2 Natural Text Editing Preset
On iTerm2 - Open Preferences > Profiles > Keys > Key Mappings > Presets > Select Natural Text Editing
- You can move a word backwards using Option ⌥ + ← and a word forwards using Option ⌥ + →
- Move to the start of the line using fn + ← and to the end of the line with fn + →.
- Also you can delete a word backwards using Option ⌥ + ⌫, delete the whole line using Command ⌘ + ⌫.
If the preset doesn't appear, reinstall iTerm2. If you installed it using Homebrew + Cask:
brew cask reinstall iterm2