Skip to content

Instantly share code, notes, and snippets.

@duanescarlett
duanescarlett / index.js
Last active April 10, 2022 00:37
Send Ether to another wallet
ethers = require('ethers')
require('dotenv').config()
async function main () {
// Connect to an EVM network
const provider = new ethers.providers.JsonRpcProvider(`https://polygon-mainnet.g.alchemy.com/v2/${process.env.RPC_KEY}`)
// Get the gas price
const gasPrice = provider.getGasPrice()
// Create a wallet object from private key
const wallet = new ethers.Wallet(`${process.env.PRIVATE_KEY}`)
@WietseWind
WietseWind / compile.bash
Last active October 12, 2021 08:35
Hook in AssemblyScript
npx asc src/assembly/hook.ts \
-O3 \
--noAssert \
--runtime minimal \
-b build/hook.wasm \
-t build/hook.wat \
-d build/hook.d.ts
@celeroncoder
celeroncoder / README.md
Created March 21, 2021 10:37
Netlify Server Functions

Server Less Functions

Instructions

  • Create a netlify.toml file for using serverless functions on the website hosted on Netlify.
  • If any other hosting service search for the documentation for creating .toml file.
  • Put the functions in the functions directory in the root of the project.
  • Every function file must contain one export handler and only that will be valid and can be used.
    exports.handler = async function(event, context) {...};
@jremi
jremi / resume.json
Last active May 25, 2023 19:44
Resume
{
"meta": {
"theme": "elegant"
},
"basics": {
"name": "Jremi",
"label": "Full-Stack Developer",
"summary": "I’m a remote full-stack Javascript developer with a frontend focus utilizing Vue.js",
"website": "https://jzbg.dev",
"picture": "https://avatars.githubusercontent.com/u/5322988",
@bradtraversy
bradtraversy / node_nginx_ssl.md
Last active July 25, 2024 06:56
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user

@lorisleiva
lorisleiva / PaymentRequest.js
Created June 4, 2018 22:02
Renderless VueJS component for Payment Requests using Stripe Element
export default {
props: {
stripe: {
type: String,
required: true,
},
options: {
type: Object,
required: true,
}
anonymous
anonymous / index.html
Created January 7, 2018 22:28
JS Bin // source https://jsbin.com/qayoyezimo
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
img {
border-radius: 8px;
border: 1px solid gray;
@NigelEarle
NigelEarle / Knex-Migrations-Seeding.md
Last active June 19, 2024 14:20
Migration and seeding instructions using Knex.js!

Migrations & Seeding

What are migrations??

Migrations are a way to make database changes or updates, like creating or dropping tables, as well as updating a table with new columns with constraints via generated scripts. We can build these scripts via the command line using knex command line tool.

To learn more about migrations, check out this article on the different types of database migrations!

Creating/Dropping Tables

@Shourai
Shourai / Allowing SSH on a server with an active OpenVPN client.md
Last active July 11, 2024 20:22
Allowing SSH on a server with an active OpenVPN client

If you want to SSH to a VPS which is running openVPN do the following:
source: https://serverfault.com/questions/659955/allowing-ssh-on-a-server-with-an-active-openvpn-client

Enable

The problem is that the default gateway gets changed by OpenVPN, and that breaks your current SSH connection unless you set up appropriate routes before you start OpenVPN.

What follows works for me. It uses iptables and ip (iproute2). Below, it is assumed that the default gateway interface before OpenVPN is started is "eth0". The idea is to ensure that when a connection to eth0 is made, even if eth0 is not the default gateway interface anymore, response packets for the connection go back on eth0 again.

You could use the same number for the connection mark, firewall mark and routing table. I used distinct numbers to make the diffences between them more apparent.

@DawidMyslak
DawidMyslak / vue.md
Last active April 22, 2024 12:49
Vue.js and Vuex - best practices for managing your state

Vue.js and Vuex - best practices for managing your state

Modifying state object

Example

If you have to extend an existing object with additional property, always prefer Vue.set() over Object.assign() (or spread operator).

Example below explains implications for different implementations.