Skip to content

Instantly share code, notes, and snippets.

@wojtekmaj
wojtekmaj / jest-to-vitest.sh
Last active April 26, 2024 14:08
Automatically migrate Jest project to Vitest
#!/bin/bash
# Ensure we're working on the latest version of the main branch
git switch main
git fetch
git pull
# Create a new branch
git switch -c vitest
@nebriv
nebriv / DDM2.0.md
Last active April 29, 2024 15:50
Dell Display Manager 2.0 command line documentation

Dell Display Manager 2.0 Command Line

Decompiled DLL with ILSpy to identify various commands.

Most commands can be found in DDM2._0_UX.CmdBackground.cmdService_DoWork

Write commands can be prefixed with int:command to specify which monitor to send the command to.

.\DDM.exe /0:writebrightnesslevel 50

@silassare
silassare / fix-esm-import-paths.js
Created July 21, 2022 09:58
Browse a folder and try to change all esm import `from`, by auto prefixing `.js` or `/index.js` only if this file exists.
import * as fs from 'fs';
import * as path from 'path';
// https://gist.github.com/lovasoa/8691344
async function* walk(dir) {
for await (const d of await fs.promises.opendir(dir)) {
const entry = path.join(dir, d.name);
if (d.isDirectory()) {
yield* walk(entry);
} else if (d.isFile()) {
@diyan
diyan / docker_buildx_kotlin_gradle.md
Created December 4, 2020 19:53
Gradle build time on AMD64 vs ARM64 using Docker multi-arch build feature

Gradle build time on AMD64 vs ARM64 using Docker multi-arch build feature

AMD64. docker buildx build --platform=linux/amd64 --tag=sample-app:amd64 .
ARM64. docker buildx build --platform=linux/arm64 --tag=sample-app:arm64 .

AMD64. An attempt to start the daemon took 1.883 secs.
ARM64. An attempt to start the daemon took 51.799 secs.

AMD64. :compileKotlin (Thread[Execution worker for ':' Thread 5,5,main]) completed. Took 25.839 secs.
#!/bin/bash
# Credits to https://gist.github.com/phette23/5270658 for inspiration
# https://superuser.com/a/599156
function setTabname {
echo -ne "\033]0;"$*"\007"
}
# set the title using above declared function and set the color of
@mojaray2k
mojaray2k / unique-array-values-js.md
Created May 28, 2020 15:48
3 Ways to get unique values from an array in Javascript

Here are 3 ways to retrieve unique values from arrays in Javascript

  1. The array.filter method which is a higher order function which means it takes a function as it's argument.
const someArray = ['😁', '💀', '💀', '💩', '💙', '😁', '💙'];

const getUniqueValues = (array) => (
  array.filter((currentValue, index, arr) => (
		arr.indexOf(currentValue) === index
@ragul28
ragul28 / webhook_install.sh
Created May 18, 2020 17:01
Easy webhook installation script to systemd.
#!/bin/bash
echo "[-] Installing webhook.."
wget https://github.com/adnanh/webhook/releases/download/2.6.11/webhook-linux-amd64.tar.gz
tar -xvf webhook*.tar.gz
sudo mv webhook-linux-amd64/webhook /usr/local/bin
rm -rf webhook-linux-amd64*
echo "[ok] Installing webhook."
@kizzx2
kizzx2 / docker-compose.yml
Last active May 9, 2024 20:00
Restart a docker container periodically with docker-compose
version: '3'
services:
app:
image: nginx:alpine
ports: ["80:80"]
restart: unless-stopped
restarter:
image: docker:cli
volumes: ["/var/run/docker.sock:/var/run/docker.sock"]
@suhlig
suhlig / install-tmux
Last active October 12, 2023 21:25 — forked from philipsd6/install-tmux
Install tmux on rhel/centos
# Install tmux on rhel/centos 7
# What do we want?
libeventversion=2.1.11
tmuxversion=3.1
# install deps
yum install gcc kernel-devel make ncurses-devel
# DOWNLOAD SOURCES FOR LIBEVENT AND MAKE AND INSTALL
@rhukster
rhukster / sphp.sh
Last active March 30, 2024 10:41
Easy Brew PHP version switching (Now moved to https://github.com/rhukster/sphp.sh)
#!/bin/bash
# Creator: Phil Cook
# Modified: Andy Miller
#
# >>> IMPORTANT: Moved to: https://github.com/rhukster/sphp.sh
# >>> Kept here for legacy purposes
#
osx_major_version=$(sw_vers -productVersion | cut -d. -f1)
osx_minor_version=$(sw_vers -productVersion | cut -d. -f2)
osx_patch_version=$(sw_vers -productVersion | cut -d. -f3)