Skip to content

Instantly share code, notes, and snippets.

@ulic-youthlic
ulic-youthlic / capslock.ahk
Last active October 22, 2024 02:01
map my <CapsLock> to <Esc>(alone) and <C-x>(with other key) using AutoHotKey v2.0.
#Requires AutoHotkey v2
; Install the keyboard hook to capture the real key state of the keyboard
InstallKeybdHook(true)
; Disable the CapsLock key
SetCapsLockState("alwaysoff")
; Send esc key when Capslock is pressed as default
g_DoNotAbortSendEsc := true
$*Capslock::{ ; Capture CapsLock key press
global g_DoNotAbortSendEsc ; use global variable g_DoNotAbortSendEsc
@Thomashighbaugh
Thomashighbaugh / nixos-dark-mode.js
Last active September 12, 2024 14:31
Dark mode for NixOS related websites (nixos.org, nixos.wiki, etc) so I can search for packages and read wiki pages, necessities when using this extremely obtuse OS I cannot escape, without burning my eyes.
// ==UserScript==
// @name Dark NixOS Package, Wiki and Main Site
// @namespace http://userstyles.org
// @description Darkened NixOS Websites, includes Wiki and Package Search
// @author Thomas Leon Highbaugh
// @homepage https://userstyles.org/styles/163453
// @match http://nixos.org/*
// @match https://nixos.org/*
// @match http://*.nixos.org/*
// @match https://*.nixos.org/*
import { Browser, chromium, firefox, webkit } from "playwright";
import { afterAll, beforeAll, describe, it } from "vitest";
const browserTypes = process.env.ALL_BROWSERS
? [chromium, firefox, webkit]
: [chromium];
for (const browserType of browserTypes) {
describe(`browser:${browserType.name()}`, () => {
let browser: Browser;
@jeremyben
jeremyben / myapp.service
Last active February 20, 2024 06:07
systemd socket activation
# https://www.freedesktop.org/software/systemd/man/systemd.unit.html
[Unit]
Description=My App
After=network.target
# https://www.freedesktop.org/software/systemd/man/systemd.exec.html
[Service]
Type=simple
# https://www.freedesktop.org/software/systemd/man/systemd.exec.html#WorkingDirectory=
WorkingDirectory=-/srv/app/
@maitrungduc1410
maitrungduc1410 / create-vod-hls.sh
Last active August 6, 2024 16:37
Bash scripts to create VOD HLS stream with ffmpeg (Extended version)
#!/usr/bin/env bash
START_TIME=$SECONDS
set -e
echo "-----START GENERATING HLS STREAM-----"
# Usage create-vod-hls.sh SOURCE_FILE [OUTPUT_NAME]
[[ ! "${1}" ]] && echo "Usage: create-vod-hls.sh SOURCE_FILE [OUTPUT_NAME]" && exit 1
# comment/add lines here to control which renditions would be created
renditions=(
@CharlesHolbrow
CharlesHolbrow / ffmpeg-hls.html
Created September 13, 2018 22:44
Example of ffmpeg for live hls streaming with hls.js
<!DOCTYPE html>
<html lang='`en'>
<head>
<meta charset='utf-8'/>
<title>Audio only stream example</title>
<script src="//cdn.jsdelivr.net/npm/hls.js@latest"></script>
<style>
video {
width: 640px;
height: 360px;
import * as admin from 'firebase-admin'
import * as fft from 'firebase-functions-test'
const ft = fft()
import * as sinon from 'sinon'
import { makeUppercase, addMessage } from './function'
describe('order', () => {
describe('makeUpperCase', () => {
it('should upper case input and write it to /uppercase', async () => {
const fakeSnaphost = ft.firestore.makeDocumentSnapshot({
@CMCDragonkai
CMCDragonkai / nix_string_and_path_concatenation.md
Last active November 14, 2024 21:22
Nix: String and Path Concatenation #nix #nixos

Nix String and Path Concatenation

From Bas van Dijk:

To understand these things I would recommend using nix-repl:

$ nix-repl
Welcome to Nix version 1.11.2. Type :? for help.
@tanyuan
tanyuan / smart-caps-lock.md
Last active November 15, 2024 08:21
Smart Caps Lock: Remap Caps Lock to Control AND Escape

Smart Caps Lock: Remap to Control AND Escape (Linux, Mac, Windows)

Caps Lock 變成智慧的 Control 以及 Escape

  • 單獨輕按一下就是 Escape
  • 若按下時同時按著其他鍵,就會是 Control

這應該是 Vim 和 Emacs 的最佳解了!(Emacs? Bash 的快捷鍵就是 Emacs 系列的)

  • Send Escape if you tap Caps Lock alone.
@kierdwyn
kierdwyn / server-git.conf
Last active March 17, 2024 22:49 — forked from massar/server-git.conf
Nginx git smart http protocol (git-http-backend) configuration with basic authentication. Need the support of fcgiwrap.
# Example nginx + git HTTP Smart mode (git-http-backend) + HTTP Authentication + HTTPS redirect
# Forked from [email protected] - http://jeroen.massar.ch
# Preparation: you need to install and configure fcgiwrap and set it to listen at fcgiwrap.socket.
# An example tutorial: https://www.howtoforge.com/serving-cgi-scripts-with-nginx-on-centos-6.0-p2
# A useful hint: add -f as a parameter to fcgiwrap to redirect the cgi errors to your nginx error log.
server {
listen 80;
server_name git.example.com;