Skip to content

Instantly share code, notes, and snippets.

View jupegarnica's full-sized avatar
🎯
Focusing

Garn jupegarnica

🎯
Focusing
View GitHub Profile
@jupegarnica
jupegarnica / keychron_linux.md
Created January 12, 2024 09:25 — forked from andrebrait/keychron_linux.md
Keychron keyboards on Linux + Bluetooth fixes

Here is the best setup (I think so :D) for K-series Keychron keyboards on Linux.

Note: K-Pro and Q-Pro series keyboards use QMK as firmware and most tips here do not apply to them. Maybe the ones related to Bluetooth can be useful, but everything else, especially stuff related to Apple's keyboard module on Linux, likely won't work.

Most of these commands have been tested on Ubuntu 20.04 and should also work on most Debian-based distributions. If a command happens not to work for you, take a look in the comment section.

Make Fn + F-keys work

Keychron Keyboards on Linux use the hid_apple driver (even in Windows/Android mode), both in Bluetooth and Wired modes.

@jupegarnica
jupegarnica / github-proxy-client.js
Created March 12, 2022 07:14 — forked from DavidWells/github-proxy-client.js
Full Github REST api in 34 lines of code
/* Ultra lightweight Github REST Client */
// original inspiration via https://gist.github.com/v1vendi/75d5e5dad7a2d1ef3fcb48234e4528cb
const token = 'github-token-here'
const githubClient = generateAPI('https://api.github.com', {
headers: {
'User-Agent': 'xyz',
'Authorization': `bearer ${token}`
}
})
#!/bin/sh
DIR=$(dirname $(realpath "$0"))
git pull
sh $DIR/tag.sh &&/
git push origin master &&/
git push --tags
#!/bin/sh
#Get the highest tag number
VERSION=`git describe --abbrev=0 --tags`
VERSION=${VERSION:-'0.0.0'}
echo $VERSION
#Get number parts
MAJOR="${VERSION%%.*}"; VERSION="${VERSION#*.}"
MINOR="${VERSION%%.*}"; VERSION="${VERSION#*.}"
PATCH="${VERSION%%.*}"; VERSION="${VERSION#*.}"
@jupegarnica
jupegarnica / index.html
Created October 23, 2021 09:11
tixy.land - three.js
<div class="buttons">
<button onclick="prevTixy()">&lt;</button>
<button onclick="nextTixy()">&gt;</button>
</div>
const elo = ([...ratings], kFactor = 32, selfRating) => {
const [a, b] = ratings;
const expectedScore = (self, opponent) =>
1 / (1 + 10 ** ((opponent - self) / 400));
const newRating = (rating, i) =>
(selfRating || rating) +
kFactor * (i - expectedScore(i ? a : b, i ? b : a));
if (ratings.length === 2)
return [newRating(a, 1), newRating(b, 0)];
name: build and publish
on:
workflow_dispatch:
push:
tags:
- v*
# BUILD_MODE: development
#!/bin/sh
#Get the highest tag number
VERSION=`git describe --abbrev=0 --tags`
VERSION=${VERSION:-'0.0.0'}
echo $VERSION
#Get number parts
MAJOR="${VERSION%%.*}"; VERSION="${VERSION#*.}"
MINOR="${VERSION%%.*}"; VERSION="${VERSION#*.}"
PATCH="${VERSION%%.*}"; VERSION="${VERSION#*.}"
const toCurrency = (n:number, curr:string, LanguageFormat:string|undefined = undefined):string =>
Intl.NumberFormat(LanguageFormat, { style: 'currency', currency: curr }).format(n);
console.log(
toCurrency(123456.789, 'EUR') // €123,456.79 | currency: Euro | currencyLangFormat: Local
)
// These give you a live reference to the exported thing(s):
import { thing } from './module.js';
import { thing as otherName } from './module.js';
import * as module from './module.js';
const module = await import('./module.js');
// This assigns the current value of the export to a new identifier:
let { thing } = await import('./module.js');
// These export a live reference:
export { thing };