Skip to content

Instantly share code, notes, and snippets.

@postmalloc
postmalloc / hn_sidebar.js
Last active August 30, 2023 08:10
Hacker News comments sidebar bookmarklet
// A handy bookmarklet to display comments from the top-rated Hacker News thread related to the current page
// Written with the help of GPT-4
javascript:(function() {
const createCommentElement = (comment, depth) => {
const commentWrapper = document.createElement('div');
commentWrapper.style.paddingLeft = (depth * 20) + 'px';
commentWrapper.style.marginBottom = '10px';
commentWrapper.style.marginLeft = '10px';
commentWrapper.style.color = '#333';
@lleyton
lleyton / translation.md
Last active January 23, 2024 16:53
(ENG) Open Source Business Challenges and Reality, Rui Ueyama

Open Source Business Challenges and Reality

Original Japanese note here.

Original Author: Rui Ueyama (creator of the mold linker)

Translated by @windowsboy111

Minimally edited by @lleyton

@yzdbg
yzdbg / auto-dr.md
Last active November 3, 2023 17:11

Automating Daily Reports, because fuck it, really...

Each day at our company, developers are required to document their activities, painstakingly jotting down their daily work and future plans. A monotonous chore that I just really dislike.

So now, there's a scribe for that :

auto-dr-

Code

@Dan-Q
Dan-Q / _no_code_page_.php
Last active July 3, 2024 22:38
Hacky PHP to produce a "blank" web page which somehow has content when viewed in Firefox. Sample page at https://danq.me/wp-content/no-code-webpage/, explanation at https://danq.me/nocode
<?php
// half-hearted CSS minification
$css = preg_replace(
array('/\s*(\w)\s*{\s*/','/\s*(\S*:)(\s*)([^;]*)(\s|\n)*;(\n|\s)*/','/\n/','/\s*}\s*/'),
array('$1{ ','$1$3;',"",'} '),
file_get_contents('linked.css')
);
// embed as a data: uri
$base64css = rtrim(strtr(base64_encode($css), '+/', '-_'), '=');
@aileftech
aileftech / hex-colors.txt
Created October 1, 2022 18:10
A Bash one-liner to produce a list of HEX color codes that read like (supposedly) valid English words
$ grep -P "^[ABCDEFabcdefOoIi]{6,6}$" /usr/share/dict/words | tr 'OoIi' '0011' | tr '[:lower:]' '[:upper:]' | awk '{print "#" $0}'
#ACAD1A
#B0BB1E
#DEBB1E
#AB1DED
#ACAC1A
#ACCEDE
#AC1D1C
#BAB1ED
#BA0BAB
@meleu
meleu / dg-publish.sh
Created April 5, 2022 16:42
dg-publish.sh
#!/usr/bin/env bash
# dg-publish.sh
###################
#
# This script adds a "dg-publish: true" to all *.md files that don't have
# a "dg-publish: " defined in it's frontmatter.
#
# Consequences of this:
# - non versioned files won't be affected (e.g.: gitignored files)
# - files without any frontmatter will have one with "dg-publish: true"
@soruly
soruly / printscreen.ps1
Last active July 26, 2022 03:39
take screenshot of desktop every 15 seconds
Add-Type -AssemblyName System.Drawing
$timer = New-Object timers.timer
$timer.Interval = 15000
$timer.Enabled = $true
$timer.start()
Register-ObjectEvent -InputObject $timer -EventName Elapsed -SourceIdentifier PrintScreen -Action {
$folderName = Get-Date -Format "yyyy-MM-dd"
$fileName = "$(Get-Date -Format "yyyy-MM-dd HH mm ss").jpg"
@AlexMikhalev
AlexMikhalev / get-obsidian-posts.py
Created January 19, 2021 13:46
Sync notion to obsidian world md
from notion.client import NotionClient
import datetime
import os
from slugify import slugify
import re
import requests
import time
import hashlib
import shutil
import sys
Usernames are used everywhere on the internet.
They are what give users a unique identity on their favorite sites.
You need to check all the usernames in a database.
Here are some simple rules that users have to follow when creating their username.
1) Usernames can only use alpha-numeric characters.
2) The only numbers in the username have to be at the end.
There can be zero or more of them at the end. Username cannot start with the number.