Skip to content

Instantly share code, notes, and snippets.

View SkyLeite's full-sized avatar
🏳️‍⚧️

Sky Leite SkyLeite

🏳️‍⚧️
View GitHub Profile
@TophC7
TophC7 / yay.md
Last active April 27, 2025 21:02
yay.nix (Yet Another Yay)

Yay (Yet Another Yay)

Yay is a fish script I created for fun really, that encapsulates a few commands I regularly run in nix. Not particularly usefull, but it was fun to make.

Commands

yay rebuild - Rebuild the NixOS configuration

Uses nh os

// Rounds up to the next nearest power-of-two value
static inline unsigned int pow2_ceil( unsigned int x ) {
#if defined( __clang__ ) || defined( __GNUC__ )
return 1 + ( ( x >= 2 ) * ( ( ( 1u << 31 ) >> ( __builtin_clz( ( x - 1 ) | 1 ) - 1 ) ) - 1 ) );
#elif defined( _MSC_VER ) && ( defined( _M_IX86 ) || defined( _M_X64 ) )
return ( 1u << 31 ) >> ( __lzcnt( ( x - 1 ) | ( x == 0 ) ) - 1 );
#elif defined( _MSC_VER ) && ( defined( _M_ARM ) || defined( _M_ARM64 ) )
return ( 1u << 31 ) >> ( __clz( ( x - 1 ) | ( x == 0 ) ) - 1 );
#else
--x; // if x is already pow2, we don't want the next pow2
@Krytos
Krytos / poe2trade.user.js
Last active November 25, 2025 22:18
Adds a button to the PoE2 Trade page that allows you to copy the item description and affixes to your clipboard.
// ==UserScript==
// @name PoE2 Trade Copy Item Button
// @version 2.0
// @description Adds a button to the PoE2 Trade page that allows you to copy the item description and affixes to your clipboard.
// @author Kevin M
// @match https://www.pathofexile.com/trade2/*
// @icon https://www.google.com/s2/favicons?domain=pathofexile.com
// @downloadURL https://gist.github.com/Krytos/fcb435878b9ee214c8ef9c5d9a685861/raw/poe2trade.user.js
// @grant none
// ==/UserScript==
@m00nwtchr
m00nwtchr / Dockerfile
Last active December 24, 2022 13:52
Compile ALVR client using Docker
# syntax=docker/dockerfile:1.3
FROM archlinux AS build
ARG VERSION="latest"
RUN --mount=type=cache,sharing=locked,target=/var/cache/pacman \
pacman -Syu --noconfirm
RUN pacman-key --init && pacman-key --recv-key FBA220DFC880C036 --keyserver keyserver.ubuntu.com && pacman-key --lsign-key FBA220DFC880C036
RUN --mount=type=cache,sharing=locked,target=/var/cache/pacman \
pacman -U --noconfirm 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-keyring.pkg.tar.zst' 'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-mirrorlist.pkg.tar.zst'
@JohnnyJayJay
JohnnyJayJay / discljord-slash-commands.md
Last active January 10, 2025 19:08
Quick primer for slash commands in discljord

Working with Slash Commands in discljord

At the end of 2020, Discord introduced a new feature that is available to bots: Slash Commands.
Slash Commands belong to a new feature category called "Interactions" which finally allows bots to enhance the Discord UI. As such, the way slash commands (and upcoming interactions such as clickable buttons aka. "components") work is quite different from other parts of the API.

What exactly are Slash Commands?

Slash commands are Discord entities that you can create, edit and delete through requests. Registered commands have a name and a description and are accessible in Discord clients by typing /name.
There are two types of commands: guild and global. As the names indicate, commands of the former type are only accessible in one specific guild

@cking
cking / README.md
Last active July 10, 2020 14:43
FFXIV Launcher Updater for Lutris

Needs:

  • unzip (to extract the nupkg archive)
  • zenity (to show fancy progress bars)
  • curl (to do the actual web request)
  • jq (to parse the json returned by github api)
  • wrestool (provided by gnome-exe-thumbnailer and/or icoutils, to parse version info of local xiv launcher)
  • tr, sed (for parsing the output of wrestool)
  • mv, rm (to move files around)

How to setup a practically free CDN using Backblaze B2 and Cloudflare

⚠️ Note 2023-01-21
Some things have changed since I originally wrote this in 2016. I have updated a few minor details, and the advice is still broadly the same, but there are some new Cloudflare features you can (and should) take advantage of. In particular, pay attention to Trevor Stevens' comment here from 22 January 2022, and Matt Stenson's useful caching advice. In addition, Backblaze, with whom Cloudflare are a Bandwidth Alliance partner, have published their own guide detailing how to use Cloudflare's Web Workers to cache content from B2 private buckets. That is worth reading,

@guilhermednt
guilhermednt / check_intermedium_private_key_leak.sh
Created May 9, 2018 23:08
Verifying Banco Intermedium's private key leak
# Today the twitter user @ayubio said he had received the private key for a Brazillian bank's HTTPS certificate:
# - https://twitter.com/ayubio/status/994260981294469120
# - https://twitter.com/ayubio/status/994262029929246722
# - https://twitter.com/ayubio/status/994277992351391744
# To prove he actualy had the key, another user asked him to sign a message with such key and so he did:
# - http://pastebin.xyz/p?q=bXllODA
# The commands bellow will check that signature
# Store the message in a file (tweet.txt) in the same way @ayubio did:
@novaluke
novaluke / 0-Q&A.md
Last active January 16, 2025 20:38
I want to use Nix for development, but... -- answers to common concerns about Nix

Nix seems perfect for developers - until I try to use it...

Want to use Nix for development but you're not sure how? Concerned about the fluidity of nixpkgs channels or not being able to easily install arbitrary package versions?

When I first heard about Nix it seemed like the perfect tool for a developer. When I tried to actually use it for developing and deploying web apps, though, the pieces just didn't seem to add up.

@travisbhartwell
travisbhartwell / nix-shell-shebang.md
Last active November 17, 2025 21:01
nix-shell and Shebang Lines

NOTE: a more up-to-date version of this can be found on my blog

nix-shell and Shebang Lines

A few days ago, version 1.9 of the Nix package manager was released. From the release notes:

nix-shell can now be used as a #!-interpreter. This allows you to write scripts that dynamically fetch their own dependencies.