Skip to content

Instantly share code, notes, and snippets.

View alanleite's full-sized avatar

Alan Leite alanleite

View GitHub Profile
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'package:http/http.dart';
import 'package:native_http/native_http.dart';
import 'package:crypto/crypto.dart';
class DebounceHttpClient extends BaseClient {
DebounceHttpClient(
@alanleite
alanleite / 1-setup.md
Created August 5, 2022 14:55 — forked from troyfontaine/1-setup.md
Signing your Git Commits using GPG on MacOS

Methods of Signing with GPG on MacOS

Last updated June 23, 2022

There are now two ways to approach this:

  1. Using gpg and generating keys
  2. Using Kryptonite by krypt.co

This Gist explains how to do this using gpg in a step-by-step fashion. Kryptonite is actually wickedly easy to use-but you will still need to follow the instructions

@alanleite
alanleite / ecr-cred-updater.sh
Created August 1, 2019 00:42 — forked from cablespaghetti/ecr-cred-updater.sh
Automatic Updating Amazon ECR Credentials in Kubernetes
#!/bin/bash
# Get directory of script
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [[ $# -ne 1 ]]
then
echo "ERROR: This script expects the namespace name to be given as an argument"
echo "e.g. ./ecr-cred-updater.sh my-namespace"
exit 1
@alanleite
alanleite / helpers.js
Created October 26, 2018 12:44
Helper for generate Query and Mutation groups using Apollo
export const withQueryWrapper = (params) => {
return (Component) => {
return (props) => (
<Query {...params}>
{({ data, loading }) => (
loading ? null :
<Component
{...props}
data={data}
@alanleite
alanleite / docker-compose.yml
Created October 18, 2018 01:32
plex + transmission
version: '3'
services:
plex:
image: linuxserver/plex:150
container_name: plex
restart: unless-stopped
network_mode: "host"
environment:
- "VERSION=latest"
@alanleite
alanleite / poc.js
Last active October 11, 2018 15:52
Validator like joi
import validateEmail from 'validator/lib/isEmail'
const exec = (func) => {
return (val) => {
try {
return func(val)
} catch (error) {
return false
}
}
@alanleite
alanleite / gist:6c991bb89297bfea45954ff3d257d091
Created September 14, 2018 17:48
Send / Receive file linux
host: 000.000.000.000
port: 0000
send
cat file.txt > /dev/tcp/000.000.000.000/0000
receive
nc -lkvv 4444 > file.txt
@alanleite
alanleite / card-brand.js
Created August 15, 2018 21:59
Card Brand by Number
module.exports = function(number) {
const rules = [
{
type: 'elo',
pattern: /^(((40117[89])|(431274)|(438935)|(451416)|(457393)|(45763[12])|(504175)|(627780)|(636297)|(636368)|(65500[0-3])|(65165[2-4])|(65048[5-8])|(650489|65049[0-4])|(506699|5067[0-6][0-9]|50677[0-8])|(509[0-8][0-9]{2}|5099[0-8][0-9]|50999[0-9])|(65003[1-3])|(65003[5-9]|65004[0-9]|65005[01])|(65040[5-9]|6504[1-3][0-9])|(65048[5-9]|65049[0-9]|6505[0-2][0-9]|65053[0-8])|(65054[1-9]|6505[5-8][0-9]|65059[0-8])|(65070[0-9]|65071[0-8])|(65072[0-7])|(65090[1-9]|65091[0-9]|650920)|(65165[2-9]|6516[67][0-9])|(65500[0-9]|65501[0-9])|(65502[1-9]|6550[34][0-9]|65505[0-8]))\d{0,16})$/,
length: [16],
cvcLength: [3]
}, {
type: 'hipercard',
pattern: /^(606282\d{10}(\d{3})?)|(3841\d{15})$/,
@alanleite
alanleite / mysql-docker.sh
Created July 4, 2018 11:48 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@alanleite
alanleite / tmux-cheatsheet.markdown
Created June 21, 2018 11:14 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname