Skip to content

Instantly share code, notes, and snippets.

View tcarrio's full-sized avatar
🧙‍♂️

Tom Carrio tcarrio

🧙‍♂️
View GitHub Profile
@tcarrio
tcarrio / codility-test-suite.js
Created December 5, 2021 05:21
Codility Test Suite (JavaScript)
/**
* Apache License
* Version 2.0, January 2004
* http://www.apache.org/licenses/
*
* TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
*
* 1. Definitions.
*
* "License" shall mean the terms and conditions for use, reproduction,
@tcarrio
tcarrio / useCallbackCache.js
Last active November 23, 2021 22:52
A React hook that supports cached memoization
import { useMemoCache } from "./useMemoCache";
export function useCallbackCache(fn, deps) {
return useMemoCache(() => fn, deps);
}
@tcarrio
tcarrio / index.html
Created April 27, 2021 01:36
battery-report-surface-pro-2
<!DOCTYPE html>
<!-- saved from url=(0016)http://localhost -->
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ms="urn:schemas-microsoft-com:xslt" xmlns:bat="http://schemas.microsoft.com/battery/2012" xmlns:js="http://microsoft.com/kernel"><head><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="ReportUtcOffset" content="-4:00"/><title>Battery report</title><style type="text/css">
body {
font-family: Segoe UI Light;
letter-spacing: 0.02em;
@tcarrio
tcarrio / sha512_crypt.py
Created October 20, 2020 03:16
Generates a random SHA512_Crypt (e.g. password hash)
#!/usr/bin/env python
import random
import string
from passlib.hash import sha512_crypt
# random 16 character salt
the_largest_salt_possible=''.join(random.choice(string.ascii_lowercase) for i in range(16))
# a large number of cycles to cop those pesky brutes
@tcarrio
tcarrio / background-noise-reduction-tools.md
Last active November 21, 2022 07:58
Background noise reduction tools (alternatives to RTX Voice)
@tcarrio
tcarrio / dbeaver.desktop
Created April 23, 2020 19:47
Override Java GTK Theme (example with DBeaver)
[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Name=DBeaver Community
GenericName=UniversaL Database Manager
Comment=Universal Database Manager and SQL Client.
Exec=sh -c "GTK_THEME='Arc' _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=on -Dswing.aatext=true -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel -Dswing.crossplatformlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel' dbeaver"
Icon=dbeaver
Categories=IDE
@tcarrio
tcarrio / README.md
Last active February 1, 2020 23:07
Generating a PKCS#12 from certbot obtained HTTPS certificates

Generating PKCS#12 from certbot Obtained Certificates

Assuming the certbot generated certificate, chain, and keys for the domain are located under

/etc/letsencrypt/live/domain.example/

You can generate the certificate file in PKCS#12 format by running the following

openssl pkcs12 -export -inkey /etc/letsencrypt/live/domain.example/privkey.pem -in /etc/letsencrypt/live/domain.example/cert.pem -certfile /etc/letsencrypt/live/domain.example/chain.pem -out certificate.p12

@tcarrio
tcarrio / jira_checkout.sh
Created January 29, 2020 22:22
Check out branch by Jira issue number
# Include in your .bashrc to access from the terminal
function gcoi() {
# Your Jira project tag
PROJ="MAV"
# Your projects branch naming convention
BRANCH_REGEX="(science|feature|bugfix|hotfix)/${PROJ}-${1}(|-.+)$"
# Get the provided issue number and validate it
OLD_IFS="${IFS}"
IFS='-'
@tcarrio
tcarrio / 10-libinput.conf
Created March 29, 2019 13:26
Trackball -> Scrollball with Kensington Orbit
# /etc/X11/10-libinput.conf
Section "InputClass"
Identifier "Marble Mouse"
MatchProduct "Kensington USB Orbit"
Driver "libinput"
Option "ScrollMethod" "button"
Option "ScrollButton" "3"
Option "MiddleEmulation" "on"
EndSection
@tcarrio
tcarrio / image.go
Created August 19, 2018 21:52
Closures man
image := &images.Image{}
err = images.List(client, params).EachPage(func(page pagination.Page) (bool, error) {
i, err := images.ExtractImages(page)
if err != nil {
return false, err
}
switch len(i) {
case 0:
return false, fmt.Errorf("No image was found matching filters: %v", params)