Skip to content

Instantly share code, notes, and snippets.

@whitefoxx
whitefoxx / README.md
Created August 2, 2026 05:07
claude-awake: keep your Mac awake (even lid-closed) while Claude Code is working — heartbeat hooks + pmset watchdog

claude-awake — Claude Code 跑长任务时不让 Mac 睡觉(合盖也行)

两个小脚本,让 MacBook 在 Claude Code 干活时保持清醒(合上盖子也继续跑),任务一结束就恢复正常睡眠,不空耗电池。

原理

心跳 + 看门狗,两个进程各司其职:

  • claude-awake-hook.sh(心跳):挂在 Claude Code 的 hooks 上。提交 prompt、每次工具调用后 touch 一个以 session_id 命名的状态文件;回合结束、会话退出时删掉。文件存在且新鲜 = 这个会话正在干活。多开几个 Claude 实例互不干扰,各管各的文件。
  • claude-awake-daemon.sh(看门狗):LaunchAgent 常驻,每 20 秒决策一次——只要有 ≥1 个「30 分钟内刷新过」的状态文件、且 CPU 没有过热降频,就 pmset -a disablesleep 1(合盖也不睡);否则翻回 0(正常睡眠)。
@kofemann
kofemann / NettyGroupBenchmark.java
Last active October 30, 2022 05:21
Netty Event loop benchmark
package dev.kofemann.playground;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.epoll.EpollEventLoopGroup;
@cemerson
cemerson / archive.org-scanned-book-downloader-bookmarklet.md
Last active October 30, 2026 14:02
Archive.org Scanned Book Downloader Bookmarklet

Archive.org Scanned Book Downloader Bookmarklet

A simple "1-click" javascript approach to downloading a scanned book from archive.org to read at your leisure on the device of your choosing w/out having to manually screenshot every pages of the book by hand. In short it's a glorified "Save Image As..." approach but consolidated down to "1 click". BTW there may be a much better option than this out there - I just built this as an autistic project to see if it would work.

Demo Video

Archive.org SBDL Demo

Obligatory Legal/Disclaimer:

By using this script you agree to delete all book files/images after your 1 hour or 14 days is up! I don't support using this script for any other use cases. After all, none of us have ever kept a library book past it's return date, right?

@romain-grecourt
romain-grecourt / idea.gdsl
Created November 8, 2021 22:07
idea.gdsl
// see https://confluence.jetbrains.com/display/GRVY/Scripting+IDE+for+DSL+awareness
import com.intellij.lang.jvm.types.JvmReferenceType
import com.intellij.psi.PsiClass
import com.intellij.psi.PsiClassObjectAccessExpression
import com.intellij.psi.PsiElement
import com.intellij.psi.PsiElementVisitor
import com.intellij.psi.PsiMethod
import com.intellij.psi.PsiParameter
import com.intellij.psi.PsiQualifiedNamedElement
@maratori
maratori / golang-mocks.md
Last active April 9, 2026 07:40
Comparison of golang mocking libraries

Comparison of golang mocking libraries

Updated 2025-05-31

[gomock][1] [testify][2] + [mockery][3] [mockio][4] [minimock][5] [moq][6]

Library

GitHub stars [![s1]][1] [![s2]][2] + [![s3]][3] [![s4]][4] [![s5]][5] [![s6]][6]
Latest release date [![d1]][r1] [![d2]][r2] + [![d3]][r3] [![d4]][r4] [![d5]][r5] [![d6]][r6]
Maintained ✅ ✅ ✅ ✅ ✅
@jrichardsz
jrichardsz / ClassScanner.java
Last active November 28, 2023 15:26 — forked from skempken/Detector.java
Find all annotated classes in a package using Spring
import java.lang.annotation.Annotation;
import java.util.LinkedList;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider;
import org.springframework.core.type.filter.AnnotationTypeFilter;
import org.springframework.web.context.support.StandardServletEnvironment;
@israel-dryer
israel-dryer / message_finder.py
Created September 19, 2020 02:08
Identify undeliverable messages in Outlook
import re
import win32com.client as client
# pattern for identifying email addresses
pattern = re.compile(r'mailto:(\w+\.\w+@company.com)')
outlook = client.Dispatch('Outlook.Application')
namespace = outlook.GetNameSpace('MAPI')
inbox = namespace.Folders['Inbox']
@agungjk
agungjk / [slug].js
Last active April 7, 2024 15:22
Crawler example on Vercel using Puppeteer and NextJS API routes
const puppeteer = require('puppeteer-core');
const cheerio = require('cheerio');
const chrome = require('chrome-aws-lambda');
export default async (req, res) => {
const slug = req?.query?.slug;
if (!slug) {
res.statusCode = 200
res.setHeader('Content-Type', 'application/json')
res.end(JSON.stringify({ id: null }))
@ChristopherA
ChristopherA / brew-bundle-brewfile-tips.md
Last active November 9, 2026 22:20
Brew Bundle Brewfile Tips

Brew Bundle Brewfile Tips

Copyright & License

Unless otherwise noted (either in this file or in a file's copyright section) the contents of this gist are Copyright ©️2020 by Christopher Allen, and are shared under spdx:Creative Commons Attribution Share Alike 4.0 International (CC-BY-SA-4.) open-source license.

Sponsor

If you more tips and advice like these, you can become a monthly patron on my GitHub Sponsor Page for as little as $5 a month; and your contributions will be multipled, as GitHub is matching the first $5,000! This gist is all about Homebrew, so if you like it you can support it by donating to them or becoming one of their Github Sponsors.

@AlexPl292
AlexPl292 / .ideavimrc
Last active August 11, 2026 00:37
My `~/.ideavimrc` file
let mapleader=" "
""" Plugins --------------------------------
set surround
set multiple-cursors
set commentary
set argtextobj
set easymotion
set textobj-entire
set ReplaceWithRegister