Skip to content

Instantly share code, notes, and snippets.

View EnchanterIO's full-sized avatar

Lukáš Lukáč EnchanterIO

View GitHub Profile
@EnchanterIO
EnchanterIO / voter_gsn_test.js
Created September 19, 2019 16:53
Lightstreams Voter.sol example powered by GSN
// Full source code: https://github.com/lightstreams-network/lightstreams-js-sdk/blob/master/test/04_gsn_voter.js
// This is for formating reasons of Medium.
require('dotenv').config({ path: `${__dirname}/.env` });
const chai = require('chai');
chai.use(require('chai-as-promised'));
const assert = chai.assert;
const { fundRecipient } = require('@openzeppelin/gsn-helpers');
@EnchanterIO
EnchanterIO / gsn-setup-relayer.md
Last active August 23, 2019 08:11 — forked from spalladino/setup-relayer.md
Manual script for setting up a GSN relayer

Manual setup for a GSN relayer

Install nginx and certbot

sudo add-apt-repository universe
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt-get install nginx software-properties-common certbot python-certbot-nginx
@EnchanterIO
EnchanterIO / twitter_unfollow_all.js
Last active June 13, 2019 15:53
Simple browser script to unfollow all Twitter users
// Open browser console
// Navigate to: https://twitter.com/following
// Scroll till end to get all the users displayed in the DOM
// Run:
$(".user-actions-follow-button").each(function() {
$(this).children("button.EdgeButton--primary").click()
});
// Better than clicking 500x unfollow :)
@EnchanterIO
EnchanterIO / ethereum_rinkeby_keystore_file.json
Created September 24, 2018 20:52
Ethereum keystore file
enchanter@lukas-gaming:~$ cat ~/.gophersland_ethereum_r1/keystore/UTC--2018-09-24T13-36-43.069452577Z--ceee57f2b700c2f37d1476a7974965e149fce2d4 | json_pp
{
"address" : "ceee57f2b700c2f37d1476a7974965e149fce2d4",
"id" : "a0ffb2a8-e312-4464-8a01-6bedde7aa4bf",
"version" : 3,
"crypto" : {
"kdf" : "scrypt",
"cipher" : "aes-128-ctr",
"mac" : "a608300aca373fd3906273d92216ccf4097d1b81dc6bcb96869b622c9acbf4f0",
"kdfparams" : {
@EnchanterIO
EnchanterIO / golang_mastery_struct_vs_object_pointer.go
Last active August 21, 2018 22:59
golang_mastery_struct_vs_object_pointer
// Copyright 2018 Lukas Lukac <https://lukaslukac.io>; All rights reserved.
// Play: https://play.golang.org/p/E34Y0SfAyK9
package main
import (
"fmt"
)
type illusion struct {
magicianCount int
@EnchanterIO
EnchanterIO / golang_mastery_struct_vs_object.go
Last active August 21, 2018 18:43
golang_mastery_struct_vs_object
// Copyright 2018 Lukas Lukac <https://lukaslukac.io>; All rights reserved.
// Play: https://play.golang.org/p/FQa09CzdtRh
package main
import (
"fmt"
)
type illusion struct {
magicianCount int
@EnchanterIO
EnchanterIO / go_ethereum_node.go
Created August 21, 2018 17:51
go-ethereum Node struct
type Node struct {
eventmux *event.TypeMux // Event multiplexer used between the services of a stack
config *Config
accman *accounts.Manager
ephemeralKeystore string // if non-empty, the key directory that will be removed by Stop
instanceDirLock flock.Releaser // prevents concurrent use of instance directory
serverConfig p2p.Config
server *p2p.Server // Currently running P2P networking layer
@EnchanterIO
EnchanterIO / benchmark_array_merge_vs_foreach_manual_addition.php
Created February 22, 2018 15:43
Benchmarks merging two arrays using array_merge and classic foreach loop with manual addition.
<?php
class Benchmark
{
/**
* @param string $mergeStrategy
* @param int $arrayToMergeSize
*
* @return void
*/
@EnchanterIO
EnchanterIO / benchmark_array_merge_in_loop.php
Last active February 22, 2018 15:42
Performance of array_merge comparing to normal element addition in a loop
<?php
$mergeStrategy = $argv[1];
$numberOfNewElements = $argv[2];
$isArrayMergeStrategy = $mergeStrategy === 'array_merge';
$isUnionStrategy = $mergeStrategy === 'union';
$list = [
[0],
@EnchanterIO
EnchanterIO / gist:29976a17d5ad26ebcfbb05c4eacb5073
Created December 1, 2017 12:02
Merge unrelated git repositories into monolith and preserve history
Goal:
Move vendor repository to "src" directory of the project while keeping git files history.
Folder: buzz-platform
git checkout -b release-pop
Navigate outside the repository:
cd ../