Skip to content

Instantly share code, notes, and snippets.

View dennohpeter's full-sized avatar
🦀
Rust`edSoul

Dennoh Peter dennohpeter

🦀
Rust`edSoul
View GitHub Profile
@quan118
quan118 / gist:33b81f6aa612272669ba07c8fe63f296
Created March 28, 2022 08:12
Ether js signedTypeData & metamask sig utils signedTypeData_v4 sample
const {signTypedData, SignTypedDataVersion} = require("@metamask/eth-sig-util");
const ethers = require("ethers");
const domain = {
name: "name",
version: "1",
verifyingContract: "0xB6Fa4E9B48F6fAcd8746573d8e151175c40121C7",
chainId: 1,
};
@tarun-ssharma
tarun-ssharma / Enabling case-insensitive auto-complete for terminal in MacOS BigSur.md
Last active June 25, 2024 21:49
Enable case-insensitive auto-complete whilst giving preference to actual matches

Add these two lines to your ~/.zshrc file:

zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}' 'r:|=*' 'l:|=* r:|=*'
autoload -Uz compinit && compinit

Tested on:

MacOS BigSur Version 11.5.1
let ip_addresses = [];
let port_numbers = [];
request("https://sslproxies.org/", function(error, response, html) {
if (!error && response.statusCode == 200) {
const $ = cheerio.load(html);
$("td:nth-child(1)").each(function(index, value) {
ip_addresses[index] = $(this).text();
});
@LukeMathWalker
LukeMathWalker / audit.yml
Last active July 2, 2024 15:09
GitHub Actions - Rust setup
name: Security audit
on:
schedule:
- cron: '0 0 * * *'
push:
paths:
- '**/Cargo.toml'
- '**/Cargo.lock'
jobs:
security_audit:
@mushonnip
mushonnip / models.py
Last active December 5, 2023 22:54
Django model to generate unique id/ booking id/ transaction id
import uuid
class Booking(models.Model):
booking_no = models.CharField(primary_key=True, default=uuid.uuid4().hex[:5].upper(), max_length=50, editable=False)
def __str__(self):
return str(self.booking_no)
@nuga99
nuga99 / docker-install-parrot.sh
Last active April 29, 2024 19:18
Install Docker Engine on Parrot OS (2023)
#!/bin/sh
# From https://www.hiroom2.com/2017/09/24/parrotsec-3-8-docker-engine-en/
# Changelog:
# @DavoedM: Apr 3, 2020
# @C922A10971734: Jan 19, 2023
set -e
# Install dependencies.
@iamchrissmith
iamchrissmith / delegatecall.md
Created April 1, 2019 20:08
Understanding msg.sender with delegatecall

To evaluate the value of msg.sender when using solidity/assembly's delegatecall:

We start out with 3 contracts:

pragma solidity ^0.5.7;

contract ScratchPadActions {
    event SenderActions(address contractAddress, address sender, address second);
    function relay(ScratchPad2 second) public returns (address) { 
        emit SenderActions(address(this), msg.sender, address(second));
@ivanbrennan
ivanbrennan / postgres-in-minikube.sh
Last active May 19, 2024 03:11
PostgreSQL in minikube
# create/update resources
kubectl --context=minikube apply -f ./postgres.yaml
# In order for the service to reach the statefulset, the following should
# be true:
# statefulset.spec.selector.matchLabels.app == service.spec.selector.app
# statefulset.spec.selector.matchLabels.role == service.spec.selector.role
# give the server some time to start up
# ...
@amoutonbrady
amoutonbrady / remove_ts.md
Created November 3, 2018 21:04
Regex to remove tsc --init default config comments
  1. Go into VSCode
  2. Install typescript npm i typescriptfor local OR npm i -g typescript for global
  3. Run either node_modules/.bin/tsc --init for local installation or tsc --init for global
  4. Open the generated file tsconfig.json and press CTRL+F
  5. Make sure to tick the regex filter for search on the far right of the search input (third icon)
  6. Pase that regex \s* \/\* .* \*\/
  7. Replace by "nothing"
@d2s
d2s / installing-node-with-nvm.md
Last active March 13, 2024 12:09
Installing Node.js to Linux & macOS & WSL with nvm

Installing Node.js with nvm to Linux & macOS & WSL

A quick guide on how to setup Node.js development environment.

Install nvm for managing Node.js versions

nvm allows installing several versions of Node.js to the same system. Sometimes applications require a certain versions of Node.js to work. Having the flexibility of using specific versions can help.

  1. Open new Terminal window.