Skip to content

Instantly share code, notes, and snippets.

@miguelmota
miguelmota / external_link_arrow.txt
Last active July 25, 2024 17:02
Unicode UTF-8 external link arrow symbol (closest thing to it)
@miguelmota
miguelmota / rsa_util.go
Last active July 24, 2024 08:34
Golang RSA encrypt and decrypt example
package ciphers
import (
"crypto/rand"
"crypto/rsa"
"crypto/sha512"
"crypto/x509"
"encoding/pem"
"log"
)
@miguelmota
miguelmota / install.sh
Created November 20, 2020 22:30
Linux install hydra
git clone https://github.com/vanhauser-thc/thc-hydra.git
cd thc-hydra/
./configure
make
sudo make install
@miguelmota
miguelmota / ethereum_keys.sh
Last active July 14, 2024 01:20
Generate Ethereum Private key, Public key, and Address using Bash and OpenSSL
# Generate the private and public keys
openssl ecparam -name secp256k1 -genkey -noout | openssl ec -text -noout > key
# Extract the public key and remove the EC prefix 0x04
cat key | grep pub -A 5 | tail -n +2 | tr -d '\n[:space:]:' | sed 's/^04//' > pub
# Extract the private key and remove the leading zero byte
cat key | grep priv -A 3 | tail -n +2 | tr -d '\n[:space:]:' | sed 's/^00//' > priv
# Generate the hash and take the address part
@miguelmota
miguelmota / primes.json
Created December 15, 2015 02:31
Array of first 1,000 prime numbers
[
2,
3,
5,
7,
11,
13,
17,
19,
23,
@miguelmota
miguelmota / event_emitter.go
Created January 22, 2019 08:43
Golang event emitter example
package main
import (
"fmt"
)
type MyEmitter map[string]chan string
func main() {
myEmitter := MyEmitter{}
@miguelmota
miguelmota / ip.go
Last active June 30, 2024 19:43
Golang get IP address from web HTTP request handler
package main
import (
"errors"
"log"
"net"
"net/http"
"strings"
)
@miguelmota
miguelmota / i3-cheat-sheet.md
Last active June 29, 2024 08:03 — forked from JeffPaine/i3-cheat-sheet.md
i3 Window Manager Cheat Sheet

i3 Window Manager Cheat Sheet

$mod refers to the modifier key (window/command or alt by default depending on config)

General

  • startx i3 start i3 from command line
  • $mod+<Enter> open a terminal
  • $mod+d open dmenu (text based program launcher)
  • $mod+r resize mode ( or to leave resize mode)
  • $mod+shift+e exit i3
@miguelmota
miguelmota / flatten_pdf.sh
Created August 3, 2021 00:45
Linux flatten PDF (remove interative forms)
pdf2ps original.pdf - | ps2pdf - flattened.pdf
@miguelmota
miguelmota / npm_downloads.js
Created June 25, 2024 18:22
Node.js get npm package downloads ranked for username
import fetch from 'node-fetch'
const username = 'UserNameGoesHere'; // Replace with the npm username
const npmAPI = `https://registry.npmjs.org/-/v1/search?text=maintainer:${username}&size=100`
async function getPackages() {
const response = await fetch(npmAPI)
const data = await response.json()
return data.objects.map(pkg => pkg.package.name)
}