How to: just copy keygen.rake
into your project, replace your-gem-name
with the name of your gem, and run!
rake keygen:publish[your-gem-name,0.1.1]
- Based on this excellent article.
- Follow me on X for more Ruby content at https://x.com/alexrudall
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. | |
; #Warn ; Enable warnings to assist with detecting common errors. | |
SendMode Input ; Recommended for new scripts due to its superior speed and reliability. | |
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. | |
; Docs: | |
; https://autohotkey.com/docs/Hotkeys.htm | |
; https://autohotkey.com/docs/KeyList.htm | |
; Ref https://autohotkey.com/board/topic/60675-osx-style-command-keys-in-windows/ |
How to: just copy keygen.rake
into your project, replace your-gem-name
with the name of your gem, and run!
rake keygen:publish[your-gem-name,0.1.1]
This recipe is a work in progress and has never been run as-is.
Make Windows PC's shortcut act like macOS (Mac OS X) (using AutoHotkey (ahk) script)
With this AutoHotKey script, you can use most macOS style shortcuts (eg, cmd+c, cmd+v, ...) on Windows with a standard PC keyboard.
There is a new, alternative project that does similar things and more, check it out at https://github.com/stevenilsen123/mac-keyboard-behavior-in-windows
import * as crypto from 'crypto' | |
const PUBLIC_KEY = 'MCowBQYDK2VwAyEA6GAeSLaTg7pSAkX9B5cemD0G0ixCV8/YIwRgFHnO54g=' | |
const LICENSE_KEY = '988214-879010-F1185E-B37E91-E53AF5-V3' | |
const LICENSE_FILE = `-----BEGIN LICENSE FILE----- | |
eyJlbmMiOiJXV0tacURadUtaMlVHcFZ4WDdabnJWL2VwbnpsemxjWnU4WXo4 | |
TlMzTEk2S25DL3RiUVhQRkQ3N2FOSWRCY1IvK2ZSYU5BZjdrZEVneGhidFA3 | |
b1diTTBlZGI1dFhxVHNIaFZSKzBZcUhqUXpNT2UxOGVuT3ROb29reW9PWUFx | |
bGJHMFNpb0QzbFc2T2lvTUFjZEwxa1d3MGd5OXBrV09lR05xV3o5T0tHaXZT | |
UWhOcHZpT005MmorQW1nSjNjMGVDL0dyNmh1ZzJrbVJFSHF6UlVPNUN3aTM3 |
First and foremost you need to set the CORS configuration for your bucket. I'm a Java developer so here's the code I wrote using the AWS Java SDK v2 to define the CORS configuration for my R2 bucket. Alternatively you can also edit your bucket CORS configuration using Postman following the tutorial at https://kian.org.uk/configuring-cors-on-cloudflare-r2/
// update the config section here with your information first
String bucketName = "YOUR_BUCKET";
String accessKeyId = "YOUR_R2_ACCESS_KEY_ID";
String secretAccessKey = "YOUR_R2_SECRET_ACCESS_KEY";
String accountId = "YOUR_ACCOUNT_ID";
URI uri = new URI("https://" + accountId + ".r2.cloudflarestorage.com");
page_dir = :desc | |
page_model = Post.reorder(created_at: page_dir) | |
page_cursor = page_model.first.id | |
page_size = 3 | |
page_num = 0 | |
loop do | |
page_num += 1 | |
page = page_model.where.not(id: page_cursor) | |
.where( |
// Use electron-builder's Keygen integration for automatic updates | |
const { autoUpdater } = require('electron-updater') | |
const { ipcMain } = require('electron') | |
// Listen for a signal from renderer to start auto-updates | |
ipcMain.on('license:valid', async (_event, license) => { | |
// Pass in a license key to authenticate with the API | |
autoUpdater.addAuthHeader(`License ${license.attributes.key}`) | |
// Check for updates |
const header = `keyid="bf9b523f-dd65-48a2-9512-fb66ba6c3714", | |
algorithm="ed25519", | |
signature="KhgcM+Ywv+DnQj4gE+DqWfNTM2TG5wfRuFQZ/zW48ValZuCHEu1h95Uyldqe7I85sS/QliCiRAF5QfW8ZN2vAw==", | |
headers="(request-target) host date digest"` | |
// Parse the parameterized header into an object | |
const params = header.split(/,\s*/g) | |
.map(keyvalue => keyvalue.match(/(?<key>[^=]+)="(?<value>[^"]+)"/i)) | |
.map(matches => matches.groups) | |
.reduce( |
import org.bouncycastle.crypto.params.Ed25519PublicKeyParameters; | |
import org.bouncycastle.crypto.signers.Ed25519Signer; | |
import org.bouncycastle.util.encoders.Hex; | |
import java.math.BigInteger; | |
import java.util.Base64; | |
class Main { | |
public static void main(String args[]) { | |
String licenseKey = "key/eyJhY2NvdW50Ijp7ImlkIjoiMWZkZGNlYzgtOGRkMy00ZDhkLTliMTYtMjE1Y2FjMGY5YjUyIn0sInByb2R1Y3QiOnsiaWQiOiIxZjA4NmVjOS1hOTQzLTQ2ZWEtOWRhNC1lNjJjMjE4MGMyZjQifSwicG9saWN5Ijp7ImlkIjoiMjlkOWQ4ZDMtYmYxZC00NGQxLWExYjktODIwNDQwZDQyMmZmIiwiZHVyYXRpb24iOm51bGx9LCJ1c2VyIjpudWxsLCJsaWNlbnNlIjp7ImlkIjoiZjNkNjU3ZGUtMmI1MC00YWRmLTg2N2ItZWYwM2RjODZhM2ZlIiwiY3JlYXRlZCI6IjIwMjEtMTAtMTRUMTU6MjA6MzIuNjcwWiIsImV4cGlyeSI6IjIwMjEtMTAtMTVUMDA6MDA6MDAuMDAwWiJ9fQ==.Z_fDBaVqmBxHWkzi_TCPWGOrE0rItN_xEFdc8TtR0ahB-Gx84S6r4pXPuTxeIREtLCVJt3lcFy_WuCNeCOFRAA=="; | |
String publicKey = "e8601e48b69383ba520245fd07971e983d06d22c4257cfd82304601479cee788"; |