Skip to content

Instantly share code, notes, and snippets.

@naps62
naps62 / live-coding.sh
Last active October 7, 2016 13:37
screenkey setup for live coding display of key presses
#!/bin/sh
# grab screen width and height
resolution=$(xrandr | grep '*' | head -n1 | tr -s ' ' | cut -d ' ' -f2)
resolution_width=$(echo $resolution | cut -d 'x' -f1)
resolution_height=$(echo $resolution | cut -d 'x' -f2)
# overlay will have full width, 80px height
width=$resolution_width
height=80
@naps62
naps62 / naps62-Ergodox---Coder-Layer.kbd.json
Last active August 17, 2022 09:45
naps62 Ergodox - Coder Layer
[
{
"backcolor": "#333333",
"name": "naps62 Ergodox - Coder Layer",
"author": "Miguel Palhas <miguel@subvisual.co>",
"radii": "20px",
"switchMount": "cherry",
"switchBrand": "cherry",
"switchType": "MX1A-G1xx",
"pcb": false,
@naps62
naps62 / naps62-Ergodox---Base-Layer.kbd.json
Last active December 6, 2021 06:51
naps62 Ergodox - Base Layer
[
{
"backcolor": "#333333",
"name": "naps62 Ergodox - Base Layer",
"author": "Miguel Palhas <miguel@subvisual.co>",
"radii": "20px",
"switchMount": "cherry",
"switchBrand": "cherry",
"switchType": "MX1A-G1xx",
"pcb": false,
@naps62
naps62 / naps62-Ergodox---Media-Layer.kbd.json
Last active November 9, 2020 13:04
naps62 Ergodox - Media Layer
[
{
"backcolor": "#333333",
"name": "naps62 Ergodox - Media Layer",
"author": "Miguel Palhas <miguel@subvisual.co>",
"radii": "20px",
"switchMount": "cherry",
"switchBrand": "cherry",
"switchType": "MX1A-G1xx",
"pcb": false,
@naps62
naps62 / Github Reviews' Review.md
Last active November 6, 2016 14:44
Feedback from my current experience with the new Github Reviews feature

Overall, I like the path where this is headed, but I have some big concerns with the current functionality. here's a quick list:

There's no easy & quick way for me to tell what's left for me to review

See the screenshot below, taken a couple of days ago:

Pull Requests

This is a list of open PRs on a client project. Some were already reviewed by me, other's weren't. For the ones I haven't reviewed, the green check mark also shows up, because our CI was green. There was no way for me to tell which ones I still haven't reviewed without opening each one individually.

@naps62
naps62 / a.pt.md
Last active November 28, 2016 21:32
Code Week 2016 Challenges

Escreve um programa o mais pequeno possível para decifrar mensagens. Podes usar C, C++, Java, Perl, Python3, Ruby 2.3.1, Pascal ou Haskell.

O teu objetivo é descodificar mensagens cifradas utilizando um método de dupla cifra. O método de cifrar é o seguinte:

  1. Removem-se todas as letras duplicadas da chave;
  2. Adiciona-se ao fim da chave as letras do alfabeto que faltam;
  3. Faz-se corresponder a cada letra da chave um número começando no valor;
  4. No fim disto temos uma tabela com o primeiro passo da substituição;
  5. Usando esta tabela, cifra-se o texto;
  6. Para criar a segunda tabela de substituição, usa-se como chave os algarismos do 0 ao 9, fazendo corresponder a cada algarismo vários valores preenchendo da esquerda para a direita;
@naps62
naps62 / arch-linux-install
Last active December 23, 2016 20:14 — forked from mattiaslundberg/arch-linux-install
Minimal instructions for installing arch linux on an UEFI system with full system encryption using dm-crypt and luks
# Install ARCH Linux with encrypted file-system and UEFI
# The official installation guide (https://wiki.archlinux.org/index.php/Installation_Guide) contains a more verbose description.
# Download the archiso image from https://www.archlinux.org/
# Copy to a usb-drive
dd if=archlinux.img of=/dev/sdX bs=16M && sync # on linux
# Boot from the usb. If the usb fails to boot, make sure that secure boot is disabled in the BIOS configuration.
# Set swedish keymap
@naps62
naps62 / webpack.rb
Created April 19, 2017 13:36
Run webpacker before test suite, only if a test tagged with JS is selected
# spec/support/webpack.rb
module WebpackTestBuild
TS_FILE = Rails.root.join("tmp", "webpack-spec-timestamp")
class << self
attr_accessor :already_built
end
def self.run_webpack
puts "running webpack-test"

Keybase proof

I hereby claim:

  • I am naps62 on github.
  • I am naps62 (https://keybase.io/naps62) on keybase.
  • I have a public key ASCgeJAumr5xLBTtCR3h6Q1FSxG9FlM1QUs9sKqAvW6Y9Qo

To claim this, I am signing this object:

@naps62
naps62 / mineTx.js
Created January 15, 2018 10:52
waiting for a transaction to be mined in truffle tests
const toTxHash = (value) => {
if (typeof value === "string") {
// this is probably a tx hash already
return value;
} else if (typeof value.receipt === "object") {
// this is probably a tx object
return value.receipt.transactionHash;
} else {
throw "Unsupported tx type: " + value;
}