Skip to content

Instantly share code, notes, and snippets.

View naugtur's full-sized avatar
🧉

Zbyszek Tenerowicz naugtur

🧉
View GitHub Profile
@naugtur
naugtur / gt.md
Created August 20, 2025 09:17
graphite cheatsheet
git checkout -b branchname
git commit
gt track
gt submit
git checkout bb
git rebase aa
@naugtur
naugtur / bangle-slides.js
Last active June 9, 2025 19:10
puck and bangle slide switching
javascript: (function () { function changed(data) { console.log("Changed!", value); bluetoothWrite(`;E.emit('myapp',${JSON.stringify(data)});\n`); } let lastSlide, cango; function poll() { slide = window.location.hash.substring(2); if (cango && slide !== lastSlide) { lastSlide = slide; changed(slide); } } /* Bluetooth Handling */ var bluetoothDevice, bluetoothServer, bluetoothService, bluetoothTX; function bluetoothConnect(finishedCb) { /* First, put up a window to choose our device */ navigator.bluetooth .requestDevice({ filters: [ { services: ["6e400001-b5a3-f393-e0a9-e50e24dcca9e"] }, { namePrefix: "Bangle.js" }, ], }) .then((device) => { /* Now connect to it */ console.log("Connecting to GATT Server..."); bluetoothDevice = device; return device.gatt.connect(); }) .then(function (server) { /* now get the 'UART' bluetooth service, so we can read and write! */ consol
@naugtur
naugtur / howto.md
Last active April 4, 2025 07:59
Busy People Conf

Busy People Conf

This document describes an event format that's easy to run, requires absolute minimal commitment to participate and provides opportunities to learn on par with going to a conference and a fraction of the inter-personal benefits too.

Wouldn't it be great to share the experience of watching talks from top conferences with your team? And do it mostly for free, without allocating much time and getting travel budgets?

There's a way to do that. It's been tested, it's easy to run and surprisingly effective.

The event recipe

https://wall.sli.do/event/eHRMVjAadQXPEJ7b9yWv1P?section=8e99a071-ab22-4a0d-b9db-daeab6ec8b10
xinput list | grep 'TrackPoint Keyboard II.*pointer' | egrep -o 'id=[0-9]+' | egrep -o '[0-9]+' | xargs -I{} xinput set-button-map {} 1 0 3
@naugtur
naugtur / module-refactor.md
Last active August 1, 2022 20:49
Visual representation of the module refactor

ModuleRecord refactoring diagrams

The purpose of this document is to ensure complete understanding of changes proposed by an attempt to reproduce them in a different medium.

Before

classDiagram
@naugtur
naugtur / keybase.md
Created December 29, 2021 19:08
keybase

Keybase proof

I hereby claim:

  • I am naugtur on github.
  • I am naugtur (https://keybase.io/naugtur) on keybase.
  • I have a public key ASC2vtIXNWCXMQyEOB91UWgRmM9Wvzx1JgmC5E7_JlHTKQo

To claim this, I am signing this object:

@naugtur
naugtur / rollingavg.js
Created September 25, 2020 11:07
rolling average
function rollingAverage(samples = 100) {
const avgHistory = [];
let avgSum = 0;
return {
add(value) {
avgHistory.push(value);
avgSum += value;
if (avgHistory.length > samples) {
const bye = avgHistory.shift();
const locales = ['en', 'pl']
export function likelyContainsTodaysDate(text: string): number {
text = text.toLocaleLowerCase()
const today = new Date()
const numDay = today.getDate()
const numMonth = today.getUTCMonth() + 1
const separators = ['.', '/', '-']
const vocabulary = [
...locales.map(loc => today.toLocaleString(loc, { month: 'long' })),
const asyncOk = async () => {
return new Promise(re => setTimeout(re, 0))
}
const asyncFail = async () => {
return new Promise((_, re) => setTimeout(() => re(Error()), 0))
}
const run1 = async () => {
try {
const [a, b] = [asyncFail(), asyncOk()]