Skip to content

Instantly share code, notes, and snippets.

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()]
@naugtur
naugtur / GetOptimizationStatus.md
Created August 9, 2019 21:08 — forked from justjavac/GetOptimizationStatus.md
V8 %GetOptimizationStatus

%GetOptimizationStatus return a set of bitwise flags instead of a single value, to access the value, you need to take the binary representation of the returned value. Now, for example, if 65 is returned, the binary representation is the following:

(65).toString(2).padStart(12, '0');
// 000001000001

Each binary digit acts as a boolean with the following meaning:

A developer's take on security

A security talk is often a hacker showing off what they can do and how you should defend.

I'm not a hacker. At least I never considered myself one in my adult life.

My team at Egnyte is running an ever-growing number of small integrations to make big apps work together.

I happened to be in the middle of a maintenance run across 30 repositories when a bunch of new vulnerabilities in popular npm packages were published. What follows is a story of good security practices at scale: 30 failed pipelines, lots of teeth grinding and finally - automation.

@naugtur
naugtur / fbwrkplc-webhook-proposal.md
Last active March 22, 2018 07:39
fbwrkplc-webhook-proposal

Link finalizatin for link collection+preview hook

Comments indicate proposed changes.

link>collection

response:

introduce linkIsFinal