Skip to content

Instantly share code, notes, and snippets.

@krogla
krogla / ipv6-pppoe.rsc
Created April 4, 2024 20:59 — forked from ebababi/ipv6-pppoe.rsc
MikroTik RouterOS Script: Configure DHCPv6-PD on the PPPoE interface.
# Configure DHCPv6-PD on the PPPoE interface.
#
# Prior script execution, enable IPv6 package:
# /system
# package enable ipv6
# reboot
#
# Resources:
# https://kb.pentanet.com.au/faq/how-to-configure-a-mikrotik-routerboard-router-to-accept-ipv6
# https://www.netdaily.org/tag/mikrotik-ipv6/
@krogla
krogla / MetamorphicContractInitCode.txt
Created May 9, 2023 06:50 — forked from 0age/MetamorphicContractInitCode.txt
Metamorphic Contract Initialization Code
* @title Metamorphic Contract
* @author 0age, derived from cloner contract by @mhswende
* @notice This contract will create a metamorphic contract, or an upgradeable
* contract that does not rely on a transparent proxy, when deployed using
* CREATE2. It expects the deployer to provide a getImplementation() function
* that will return an implementation address, which it will then clone and
* deploy. Unlike with upgradeable transparent proxies, the state of a
* metamorphic contract will be wiped clean with each upgrade. With great power
* comes great responsibility - implement appropriate controls and educate the
* users of your contract if it will be interacted with!
// SPDX-License-Identifier: GPL-3.0
// solhint-disable-next-line lido/fixed-compiler-version
pragma solidity >=0.4.24 <0.9.0;
library UnstructuredStorageMap {
function getStorageMappingUint256(bytes32 position, uint256 key) internal view returns (uint256 data) {
return getStorageMappingUint256Offset(position, key, 0);
}
const connectToKeplr = async (): Promise<any> => {
if (window.keplr) {
window.keplr
.experimentalSuggestChain({
// Chain-id of the Regen chain.
chainId,
// The name of the chain to be displayed to the user.
chainName: 'Regen Devnet',
// RPC endpoint of the chain.
rpc: 'http://devnet.regen.network:26657',
@krogla
krogla / parallels-reset.sh
Created June 10, 2022 08:11 — forked from gdurastanti/parallels-reset.sh
Reset Parallels' trial
#!/bin/sh
# Reset Parallels Desktop's trial and generate a casual email address to register a new user
rm /private/var/root/Library/Preferences/com.parallels.desktop.plist /Library/Preferences/Parallels/licenses.xml
jot -w pdu%d@gmail.com -r 1
const { create, globSource } = require('ipfs-http-client')
const globSourceOptions = {
recursive: true
}
const addOptions = {
pin: true,
wrapWithDirectory: true,
timeout: 10000
@krogla
krogla / MiddlewareES6.js
Created April 29, 2020 15:12 — forked from sylvainleris/MiddlewareES6.js
A very minimal Javascript (ES5 & ES6) Middleware Pattern Implementation
class Middleware {
constructor() {
// Array prototype last
if (!Array.prototype.last) {
Array.prototype.last = function() {
return this[this.length - 1];
}
}
@krogla
krogla / index.ts
Created April 29, 2020 15:12 — forked from Curtis017/index.ts
Simple middleware implementation using typescript and ES6
import pipeline, { Middleware } from './pipeline';
const step1: Middleware<any, any> = (req, res, next) => {
if (req.body) {
console.log(`STEP 1: \n req: ${JSON.stringify(req)}\n res: ${JSON.stringify(res)}`);
next();
}
}
const step2: Middleware<any, any> = async (req, res, next) => {
@krogla
krogla / client.js
Created October 4, 2019 19:27 — forked from crtr0/client.js
A simple example of setting-up dynamic "rooms" for socket.io clients to join
// set-up a connection between the client and the server
var socket = io.connect();
// let's assume that the client page, once rendered, knows what room it wants to join
var room = "abc123";
socket.on('connect', function() {
// Connected, let's sign-up for to receive messages for this room
socket.emit('room', room);
});
@krogla
krogla / remove.js
Last active March 7, 2018 10:43
remove unused contracts from Mist
//rename unused contracts to '--' and run script
CustomContracts.find().fetch().map(
function(m) { if (m.name == '--') {CustomContracts.remove(m._id);}}
)