Skip to content

Instantly share code, notes, and snippets.

View k0pernikus's full-sized avatar

Philipp Kretzschmar k0pernikus

View GitHub Profile
@k0pernikus
k0pernikus / powershell_github_ghost_notification_removal
Created October 23, 2025 15:27
github ghost notifcation removal
Source: https://github.com/orgs/community/discussions/6874#discussioncomment-14734100
# Windows Powershell
gh api /notifications -X GET | ConvertFrom-Json | ForEach-Object { gh api "/notifications/threads/$($_.id)" -X PATCH }
# Linux
gh api /notifications -X GET | jq -r '.[].id' | xargs -I {} gh api /notifications/threads/{} -X PATCH
@k0pernikus
k0pernikus / list-merges.sh
Created October 9, 2025 12:32
git purge merge commit from history
#!/usr/bin/env bash
N=${1:-5}
if ! git rev-parse --is-inside-work-tree > /dev/null 2>&1; then
echo "Error: Not inside a Git repository."
exit 1
fi
git log --merges -n "$N" \
@k0pernikus
k0pernikus / download.sh
Last active September 8, 2025 14:11
wget with sanity content-length check
#!/usr/bin/env bash
set -euo pipefail
usage() {
echo "Usage: $0 -u <URL> -p <path>" >&2
echo " -u URL of the file to download." >&2
echo " -p Local path and filename to save the file as." >&2
return 1
@k0pernikus
k0pernikus / enable_xdebug.sh
Last active January 21, 2025 11:54
Create xdebug config file in local user's home dir
#!/usr/bin/env bash
mkdir -p ~/config/etc/php/8.0/fpm/conf.d/
touch ~/config/etc/php/8.0/fpm/conf.d/20-xdebug.ini
cat > ~/config/etc/php/8.0/fpm/conf.d/20-xdebug.ini <<EOL
zend_extension=xdebug.so
xdebug.mode = debug
xdebug.client_host = 127.0.0.1
xdebug.client_port = 9003
@k0pernikus
k0pernikus / OUTPUT_01_unexpected
Last active December 9, 2024 12:25
Unexpected inline config
eslint --no-config-lookup --rule "no-console: error" having_inline_rule_enabled.js
1:1 error Unexpected console statement no-console
1:13 error Strings must use doublequote quotes
5:33 error Strings must use doublequote quotes
✖ 3 problems (3 errors, 0 warnings)
2 errors and 0 warnings potentially fixable with the `--fix` option.
@k0pernikus
k0pernikus / bubbles-must-be-set-for-custom-events.js
Created November 12, 2024 12:13
custom event in do not bubble by default, one has to set bubbles true
const customEventHandling = () => {
document.addEventListener('this-is-my-custom-event', (event) => {
console.log('THIS SHOULD PRINT ON DISPATCHED EVENT!');
console.log(event)
});
document.onreadystatechange = () => {
if (document.readyState !== "complete") {
console.log('not ready yet');
@k0pernikus
k0pernikus / error.log
Created October 23, 2019 10:29
node-curl error during `yarn install`
yarn install
yarn install v1.19.1
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.1.3: The platform "linux" is incompatible with this module.
info "fsevents@1.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
[-/6] ⠄ waiting...
[-/6] ⠄ waiting...
@k0pernikus
k0pernikus / package-lock.json
Last active July 26, 2019 12:17
Example of how one library can introduce a multiple thousand long lockfile via npm.
{
"name": "jest-test",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@babel/code-frame": {
"version": "7.5.5",
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.5.5.tgz",
"integrity": "sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw==",
@k0pernikus
k0pernikus / gist:ed2788130d15aca80cbdaf398da89719
Created May 14, 2018 11:51
highland error promise rejection
highland(range).map((i) => {
return highland(createPromise(i));
})
.flatten()
.errors((error, push) => {
if (error) {
push(null, null);
}
})
.compact()
@k0pernikus
k0pernikus / LazyFuture.scala
Created April 23, 2018 13:39
LazyFuture for scala, prototype, wip, based on stackoverflow answer
package com.dreamlines.commons
import scala.concurrent.{ExecutionContext, Future}
/**
* This LazyFuture helps working with futures with concurrency
*
* @param f
* @tparam A
*/