Skip to content

Instantly share code, notes, and snippets.

@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 / Gruntfile.coffee
Last active January 23, 2017 05:47
quick Grunt.js setup with Sass + Coffee + Slim
module.exports = (grunt) ->
# configuration
grunt.initConfig
# grunt sass
sass:
compile:
options:
style: 'expanded'

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 / Rakefile
Created May 30, 2014 13:01
Retrying failing cucumber steps automatically until everything is green
require 'cucumber/rake/task'
NUM_RETRIES = ENV['NUM_RETRIES'] || 2
task :default => "cucumber:run"
namespace :cucumber do
directory "tmp"
@rerun_file = 'tmp/rerun.txt'
@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;
}
%{
configs: [
%{
name: "default",
strict: true,
color: true,
checks: [
# Consistency
{Credo.Check.Consistency.MultiAliasImportRequireUse, false},
@naps62
naps62 / focus-mode.vim
Last active June 16, 2020 10:08
Vim focus mode
let g:focused = 0
function! Focus()
let g:focused = 1 - g:focused
if g:focused == 1
let b:coc_suggest_disable = 1
:Goyo 120
:Limelight
:Voom markdown
:exe "normal \<C-w>\<C-w>"
@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 / 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"