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.
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 |
| // ==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== |
| # 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' |
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.
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
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)
⚠️ 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,
| # 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: |
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.
NOTE: a more up-to-date version of this can be found on my blog
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.