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}`
}
})
@jupegarnica
jupegarnica / flappy.html
Created December 19, 2020 07:51 — forked from gullyn/flappy.html
Flappy bird in 205 bytes (improved!)
<body onload=z=c.getContext`2d`,setInterval(`c.width=W=150,Y<W&&P<Y&Y<P+E|9<p?z.fillText(S++${Y=`,9,9|z.fillRect(p`}*0,Y-=--M${Y+Y},P+E,9,W),P))):p=M=Y=S=6,p=p-6||(P=S%E,W)`,E=49) onclick=M=9><canvas id=c>
@jupegarnica
jupegarnica / tailc
Created November 13, 2020 11:46 — forked from liufuyang/tailc
Color output of linux tail command
#!/bin/bash
# save this file as tailc then
# run as: $ tailc logs/supplier-matching-worker.log Words_to_highlight
file=$1
if [[ -n "$2" ]]; then
color='
// {print "\033[37m" $0 "\033[39m"}
/(WARN|WARNING)/ {print "\033[1;33m" $0 "\033[0m"}
/(ERROR|CRIT)/ {print "\033[1;31m" $0 "\033[0m"}
@jupegarnica
jupegarnica / regexp_extension.rb
Created August 10, 2020 06:41 — forked from ssaunier/regexp_extension.rb
Create regex patterns insensitive to accented characters
# Copyright: Applidget - 2013
# License: MIT
# Author: Sébastien Saunier (@ssaunier)
#
# Create regex patterns insensitive to accented characters
# Useful when querying a name in MongoDB
# Mapping array source: http://stackoverflow.com/a/228006/197944, with a .gsub("\\x", "\\u00")
class RegexpExtension
@jupegarnica
jupegarnica / sampleREADME.md
Created May 29, 2020 06:55 — forked from FrancesCoronel/sampleREADME.md
A sample README for all your GitHub projects.

FVCproductions

INSERT GRAPHIC HERE (include hyperlink in image)

Repository Title Goes Here

Subtitle or Short Description Goes Here

import { useState } from "react";
export function useLocalStorage<T>(key: string, initialValue: T): [T, (s: T) => void] {
// State to store our value
// Pass initial state function to useState so logic is only executed once
const [storedValue, setStoredValue] = useState<T>(() => {
try {
// Get from local storage by key
const item = window.localStorage.getItem(key);
// Parse stored json or if none return initialValue
/**
* Print Stylesheet fuer Deinewebsite.de
* @version 1.0
* @lastmodified 16.06.2016
*/
@media print {
/* Inhaltsbreite setzen, Floats und Margins aufheben */
/* Achtung: Die Klassen und IDs variieren von Theme zu Theme. Hier also eigene Klassen setzen */
const inBrowser = typeof window !== 'undefined'
// get user agent
const UA = inBrowser && window.navigator.userAgent.toLowerCase()
// detect browser
const isIE = UA && /msie|trident/.test(UA)
const isIE9 = UA && UA.indexOf('msie 9.0') > 0
const isEdge = UA && UA.indexOf('edge/') > 0
const isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge
@jupegarnica
jupegarnica / json.js
Created February 12, 2020 14:29 — forked from bitfishxyz/json.js
const isString = value => typeof value === 'string';
const isSymbol = value => typeof value === 'symbol'
const isUndefined = value => typeof value === 'undefined'
const isDate = obj => Object.prototype.toString.call(obj) === '[object Date]'
const isFunction = obj => Object.prototype.toString.call(obj) === '[object Function]';
const isComplexDataType = value => (typeof value === 'object' || typeof value === 'function') && value !== null;
const isValidBasicDataType = value => value !== undefined && !isSymbol(value);
const isValidObj = obj => Array.isArray(obj) || Object.prototype.toString.call(obj) === '[object Object]';
const isInfinity = value => value === Infinity || value === -Infinity