Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env node
import esbuild from "esbuild";
import fs from "fs/promises";
import { resolve as resolvePath } from "path";
const [root] = process.argv.slice(2);
console.log(JSON.stringify(await getGnomeExtensionGiDependencies(root)));
async function getGnomeExtensionGiDependencies(root) {
const entryPoints = [resolvePath(root, "extension.js")];
@piousdeer
piousdeer / example.nix
Last active November 2, 2024 16:00
Create mutable files with home-manager and Nix
{
home.file."test-file" = {
text = "Hello world";
force = true;
mutable = true;
};
}
@piousdeer
piousdeer / gnome-44-load-new-extensions.js
Last active July 12, 2023 23:37
Load newly installed GNOME extensions without restarting GNOME: run this script in Looking Glass (Alt+F2 and type 'lg')
const ExtensionUtils = imports.misc.extensionUtils;
const FileUtils = imports.misc.fileUtils;
const { ExtensionType } = ExtensionUtils;
(async function () {
let perUserDir = Gio.File.new_for_path(global.userdatadir);
const extensionFiles = [...FileUtils.collectFromDatadirs('extensions', true)];
const extensionObjects = extensionFiles.map(({dir, info}) => {
{ lib
, fetchFromGitHub
, rustPlatform
, pkg-config
, dbus
, xorg
, pango
, cairo
, libusb
, libvpx
<script>
function calc(from = 0, to = Infinity) {
const ctx = document.querySelector("canvas").getContext("2d");
ctx.font = "DejaVu Sans";
results = [];
let i = from;
while (i < to) {
let char;
if (i % 0xff == 0) {
console.log("0x" + i.toString(16));
#!/bin/bash
OUT_FILE="$(xdg-user-dir DOCUMENTS)/Домашка на $(date --iso-8601).pdf"
CAMERA_PATH="/run/user/1000/gvfs/sftp:host=192.168.0.2,port=1739/primary/DCIM/Camera"
convert -monitor -auto-orient -quality 35 -strip `ls -1tr $CAMERA_PATH/* | tail -${1:-1}` "$OUT_FILE"
@piousdeer
piousdeer / nvfixbl.sh
Created August 21, 2021 18:00 — forked from redsfyre/nvfixbl.sh
Simple script I wrote for Arch Linux to use Nvidia brightness setting properly
#!/bin/bash
for x in \
nvidia-460.67-5-x86_64.pkg.tar.zst \
nvidia-dkms-460.67-1-x86_64.pkg.tar.zst \
nvidia-settings-460.67-1-x86_64.pkg.tar.zst \
nvidia-utils-460.67-1-x86_64.pkg.tar.zst \
; do
test -f $x || \
@piousdeer
piousdeer / .bashrc
Created June 8, 2021 17:05
Recognize music playing on your Linux computer via a terminal command
audd() {
api_token=test # get one from https://audd.io or use "test" if you don't mind the rate limits
source="$(pactl info | grep 'Default Sink' | cut -d":" -f2 | cut -c2-).monitor"
echo "Listening..."
ffmpeg -hide_banner -loglevel error -f pulse -i $source -t 7 -y /tmp/audd.ogg || return 1
echo "Uploading..."
curl -s -F api_token=$api_token -F file=@/tmp/audd.ogg https://api.audd.io | jq
}
@piousdeer
piousdeer / fake-fullscreen.js
Last active August 24, 2020 17:49
Force fullscreen UI on sites like YouTube without actually making your browser window fullscreen
let fullscreenElement;
Object.defineProperty(document, "fullscreenElement", {
get() {
return fullscreenElement;
},
set(value) {
fullscreenElement = value;
},
});
__npm_safeguard() {
python3 ~/npm_safeguard.py $1 && command "$@"
}
npm() {
__npm_safeguard npm "$@"
}
pnpm() {
__npm_safeguard pnpm "$@"
}
yarn() {