Skip to content

Instantly share code, notes, and snippets.

@miguelmota
miguelmota / nodejs-directory-structure.md
Last active December 2, 2023 08:47
Node.js MVC directory structure example.
View nodejs-directory-structure.md
Node.js MVC directory structure example.
├── app
│   ├── controllers
│   │   ├── admin
│   │   │   ├── posts.js
│   │   │   └── users.js
│   │   ├── posts.js
│ │ ├── session.js
@miguelmota
miguelmota / hdwallet.go
Created July 7, 2018 22:25
Golang Ethereum HD Wallet implementation
View hdwallet.go
package hdwallet
import (
"crypto/ecdsa"
"errors"
"fmt"
"github.com/btcsuite/btcd/chaincfg"
"github.com/btcsuite/btcutil/hdkeychain"
"github.com/ethereum/go-ethereum/accounts"
@miguelmota
miguelmota / server.go
Last active November 27, 2023 13:43
Golang TCP server example
View server.go
package server
import (
"bufio"
"fmt"
"log"
"net"
)
// Server ...
@miguelmota
miguelmota / 30-touchpad.conf
Created February 29, 2020 02:44
Arch linux enable tap to click on touchpad
View 30-touchpad.conf
Section "InputClass"
Identifier "touchpad"
Driver "libinput"
MatchIsTouchpad "on"
Option "Tapping" "on"
Option "TappingButtonMap" "lmr"
EndSection
@miguelmota
miguelmota / erc20.go
Last active November 25, 2023 17:08
Go go-ethereum watch ERC-20 token transfer events
View erc20.go
// Code generated - DO NOT EDIT.
// This file is a generated binding and any manual changes will be lost.
package token
import (
"math/big"
"strings"
ethereum "github.com/ethereum/go-ethereum"
@miguelmota
miguelmota / server.js
Created November 15, 2022 23:20
Node.js express cors whitelist example
View server.js
const whitelist = ['http://localhost:3000']
const corsOptions = {
origin: function (origin, callback) {
if (whitelist.includes(origin)) {
callback(null, true)
} else {
console.log('origin:', origin, 'not allowed')
callback(new Error('Not allowed by CORS'))
}
}
@miguelmota
miguelmota / scrape.py
Last active November 19, 2023 22:43
Python Selenium Web Driver login example
View scrape.py
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
config = {
'EMAIL': '',
'PASSWORD': ''
}
login_url = 'http://video.springserve.com/'
@miguelmota
miguelmota / process_names.txt
Last active November 18, 2023 21:17
macOS process whitelist
View process_names.txt
# not an exhaustive list
nsurlsessiond "icloud sync"
fseventsd "macos file system events"
WindowServer "macos windows"
DisplayLinkManager "macos driver"
configd "macos dynamic configuration"
displaypolicyd "macos process"
CommCenter "macos keychain"
kernel_task "macos kernel"
@miguelmota
miguelmota / .xinitrc
Last active November 18, 2023 10:54
Arch linux LXDE setup instructions
View .xinitrc
exec startlxde
@miguelmota
miguelmota / HelloWorld.proto
Last active November 17, 2023 14:04
Golang gRPC protobuf hello world example (also using grpcurl)
View HelloWorld.proto
syntax = "proto3";
package protos;
service HelloWorld {
rpc SayHello (HelloRequest) returns (HelloResponse) {}
}
message HelloRequest {
string name = 1;