Skip to content

Instantly share code, notes, and snippets.

View adam-hanna's full-sized avatar
💭
breaking things...

Adam Hanna adam-hanna

💭
breaking things...
View GitHub Profile
#include "IPlugEffect.h"
#include "IPlug_include_in_plug_src.h"
#include "IControls.h"
#include "IWebViewControl.h"
#include "json.hpp"
using json = nlohmann::json;
IPlugEffect::IPlugEffect(const InstanceInfo& info)
: Plugin(info, MakeConfig(kNumParams, kNumPrograms))
use test::Bencher;
#[derive(Debug)]
pub struct Rate {
pub id: u8,
pub from: String,
pub to: String,
pub exchange: String,
pub rate: f64,
pub vol: f64,
@jb-alvarado
jb-alvarado / pci-passthrough.md
Last active October 27, 2023 02:16
PCI Passthrough on Fedora 31

PCI Passthrough

Hardware:

  • Mainboard ASUS PRIME Z390-A Z390
  • ASUS Dual-GTX1650-O4G
  • Intel i9 9900
  • 32GB Ram
  • NEC Corporation uPD720200 USB 3.0 Host Controller
  • Samsung Electronics Co Ltd NVMe SSD Controller SM981/PM981/PM983 (1 TB)
@harveyconnor
harveyconnor / a-mongodb-replica-set-docker-compose-readme.md
Last active June 18, 2024 12:38
MongoDB Replica Set / docker-compose / mongoose transaction with persistent volume

This will guide you through setting up a replica set in a docker environment using.

  • Docker Compose
  • MongoDB Replica Sets
  • Mongoose
  • Mongoose Transactions

Thanks to https://gist.github.com/asoorm for helping with their docker-compose file!

@OliverJAsh
OliverJAsh / foo.tsx
Last active August 15, 2023 06:43
TypeScript React HOC using `forwardRef`
import * as React from 'react';
import { Component, ComponentClass, createRef, forwardRef, Ref } from 'react';
const myHoc = <ComposedComponentProps extends {}>(
ComposedComponent: ComponentClass<ComposedComponentProps>,
) => {
type ComposedComponentInstance = InstanceType<typeof ComposedComponent>;
type WrapperComponentProps = ComposedComponentProps & {
wrapperComponentProp: number;
@miguelmota
miguelmota / README.md
Last active December 29, 2022 23:27
summary notes on blockchain whitepaper reading

Blockchain reading notes

Rocket Pool

  • https://docs.rocketpool.net/guides/staking/overview.html#how-eth2-staking-works
  • deposit eth to rocket pool smart contracts
  • Smart Node Network run rocket pool Smart Node software.
  • Smart node communicates with protocol's smart contract and provide consensus required by Beacon Chain.
  • need 16 eth to run Smart Node
  • must put up RPL as collateral for insuring and bonding their node against bad behavior
  • Minipool Validators are smart contracts created by operators who deposit 16 ETH on their node. This smart contract recieves 16ETH deposits from users who want to stake but not run nodes (rETH stakers). A new validator is creatd when this contract contains a t total of 32 ETH (16 ETH initial and 16 ETH from rETH stakers)
@kelby
kelby / Bulletproofs.go
Created October 22, 2018 16:46
This project implements Bulletproofs in Go.
package bp
import (
"crypto/elliptic"
"crypto/rand"
"crypto/sha256"
"encoding/binary"
"math/big"
"fmt"
const csvStringToArray = strData =>
{
const objPattern = new RegExp(("(\\,|\\r?\\n|\\r|^)(?:\"([^\"]*(?:\"\"[^\"]*)*)\"|([^\\,\\r\\n]*))"),"gi");
let arrMatches = null, arrData = [[]];
while (arrMatches = objPattern.exec(strData)){
if (arrMatches[1].length && arrMatches[1] !== ",")arrData.push([]);
arrData[arrData.length - 1].push(arrMatches[2] ?
arrMatches[2].replace(new RegExp( "\"\"", "g" ), "\"") :
arrMatches[3]);
}
@miguelmota
miguelmota / userhomedir.go
Last active April 11, 2022 00:33
Golang get user home directory path
package main
import (
"fmt"
"os"
"runtime"
)
func userHomeDir() string {
if runtime.GOOS == "windows" {
@miguelmota
miguelmota / fkill.sh
Last active April 22, 2018 22:11
bash script to kill process by name or port (like `fkill` NPM package, but not taking up your entire disk space with node_modules)
# kill process by name or port
# example:
# fkill someapp :8080 node :1111
fkill() {
for i in $@;do export q=$i;if [[ $i == :* ]];then lsof -i$i|sed -n '1!p';
else ps aux|grep -i $i|grep -v grep;fi|awk '{print $2}'|\
xargs -I@ sh -c 'kill -9 @&&printf "X %s->%s\n" $q @';done