Skip to content

Instantly share code, notes, and snippets.

View pubkey's full-sized avatar
🤯
You don't need a backend

Daniel Meyer pubkey

🤯
You don't need a backend
View GitHub Profile
@kilbot
kilbot / database.ts
Last active October 9, 2024 07:29
RxStorage adapter for expo-sqlite
import { createRxDatabase } from 'rxdb';
import { getRxStorageSQLite, SQLiteQueryWithParams } from 'rxdb-premium/plugins/sqlite';
import { openDatabase, WebSQLDatabase, ResultSet } from 'expo-sqlite';
/**
* Polyfill for TextEncoder
* fixes: ReferenceError: Can't find variable: TextEncoder
*/
import 'fast-text-encoding';
@LefterisJP
LefterisJP / TheCyber.md
Last active May 20, 2018 11:23
TheCyber

"The Cyber" Challenge

On 23/03/18 in the evening I got a PGP encrypted email with an invitation to a challenge involving two ethereum smart contracts called "The Cyber". I was intrigued and spent a bit of time solving the "GateKeeper" puzzles to enter the challenge. Now I would like to share it with whomever else wants to try solving it.

Below is the original message I got -- minus the passphrases.

Original Message

Hello

You have been formally invited to join theCyber, a decentralized club on the Ethereum blockchain. The contract (thecyber.eth | 0x97A99C819544AD0617F48379840941eFbe1bfAE1) is straightforward by design and deliberately avoids equity memberships, dues, contract ownership or migration, and voting or other governance. Rather, theCyber is intended to operate as a testbed that its members can use to communicate, attend events, and collaborate.

@simon-contreras-deel
simon-contreras-deel / local-mongo-replicaset-with-docker
Last active November 16, 2023 16:57
[Local mongo replicaset with docker] #docker #mongo
# pull the official mongo docker container
docker pull mongo
# create network
docker network create my-mongo-cluster
# create mongos
docker run -d --net my-mongo-cluster -p 27017:27017 --name mongo1 mongo mongod --replSet my-mongo-set --port 27017
docker run -d --net my-mongo-cluster -p 27018:27018 --name mongo2 mongo mongod --replSet my-mongo-set --port 27018
docker run -d --net my-mongo-cluster -p 27019:27019 --name mongo3 mongo mongod --replSet my-mongo-set --port 27019
#run all via:
# wget -O - https://gist.githubusercontent.com/pubkey/27083b667698b8d7b32bbcb0d413f78b/raw/6a2a75097112f1c4d25800cf03c7de025663fd17/new_linux.bash | bash
apt-get update
apt-get upgrade -y
apt-get dist-upgrade -y
# choo choo!
@alexvandesande
alexvandesande / Random generator
Last active December 23, 2022 09:10
A very simple random generator. A miner can influence the number by not publishing a block with an unwanted outcome, and forfeiting the 5 block reward.
contract random {
/* Generates a random number from 0 to 100 based on the last block hash */
function randomGen(uint seed) constant returns (uint randomNumber) {
return(uint(sha3(block.blockhash(block.number-1), seed ))%100);
}
/* generates a number from 0 to 2^n based on the last n blocks */
function multiBlockRandomGen(uint seed, uint size) constant returns (uint randomNumber) {
uint n = 0;
for (uint i = 0; i < size; i++){
@alexis89x
alexis89x / broadcast-channel-es6.js
Last active July 23, 2024 06:31
Broadcast Channel API polyfill
/**
@class BroadcastChannel
A simple BroadcastChannel polyfill that works with all major browsers.
Please refer to the official MDN documentation of the Broadcast Channel API.
@see <a href="https://developer.mozilla.org/en-US/docs/Web/API/Broadcast_Channel_API">Broadcast Channel API on MDN</a>
@author Alessandro Piana
@version 0.0.6
*/
/*
@staltz
staltz / introrx.md
Last active November 17, 2024 01:08
The introduction to Reactive Programming you've been missing
@rxaviers
rxaviers / gist:7360908
Last active November 16, 2024 07:02
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@ryoppy
ryoppy / getQueryParams.js
Last active March 28, 2019 17:31
Parse query string. use Underscore.js.
/**
* Parse query string.
* ?a=b&c=d to {a: b, c: d}
* @param {String} (option) queryString
* @return {Object} query params
*/
getQueryParams: function(queryString) {
var query = (queryString || window.location.search).substring(1); // delete ?
if (!query) {
return false;