Skip to content

Instantly share code, notes, and snippets.

View rithvikvibhu's full-sized avatar

Rithvik Vibhu rithvikvibhu

View GitHub Profile
@rithvikvibhu
rithvikvibhu / index.js
Created January 15, 2017 10:44
Feathers socket auth
import React, { Component, AsyncStorage } from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { Router, Scene } from 'react-native-router-flux';
import hooks from 'feathers-hooks';
import feathers from 'feathers/client';
import socketio from 'feathers-socketio/client';
import localstorage from 'feathers-localstorage';
import authentication from 'feathers-authentication-client';
@rithvikvibhu
rithvikvibhu / app.js
Created January 16, 2017 14:41
Feathers socket auth - Server side
const path = require('path');
const serveStatic = require('feathers').static;
const favicon = require('serve-favicon');
const compress = require('compression');
const cors = require('cors');
const feathers = require('feathers');
const configuration = require('feathers-configuration');
const hooks = require('feathers-hooks');
const rest = require('feathers-rest');
const bodyParser = require('body-parser');
@rithvikvibhu
rithvikvibhu / server-log
Created January 16, 2017 14:52
Feathers server debug log
socket.io-parser decoded 22["foods::get","5877783b2aa1cc1c04a0c1e3",{}] as {"type":2,"nsp":"/","id":2,"data":["foods::get","5877783b2aa1cc1c04a0c1e3",{}]} +47ms
socket.io:socket got packet {"type":2,"nsp":"/","id":2,"data":["foods::get","5877783b2aa1cc1c04a0c1e3",{}]} +48ms
socket.io:socket emitting event ["foods::get","5877783b2aa1cc1c04a0c1e3",{}] +0ms
socket.io:socket attaching ack callback to event +0ms
socket.io:socket dispatching an event ["foods::get","5877783b2aa1cc1c04a0c1e3",{},null] +0ms
feathers-socket-commons:methods Got 'foods::get' event with connection +0ms { provider: 'socketio',
user:
{ email: 'a@a.aa',
password: '$2a$10$5zufdjXThNFf38k..s/x8unwuciO/EJP2fet0VAy6erO9ulptBB62',
_id: 'Ws2fg5IzolYDKgJc' },

Keybase proof

I hereby claim:

  • I am rithvikvibhu on github.
  • I am rithvikvibhu (https://keybase.io/rithvikvibhu) on keybase.
  • I have a public key whose fingerprint is 0393 D763 6C08 EFA8 A781 F9CD E851 01DF 1682 E27F

To claim this, I am signing this object:

@rithvikvibhu
rithvikvibhu / entrarcanteen.js
Created January 14, 2018 07:32
Greasemonkey script to inject link into Entrar
// ==UserScript==
// @name DPS Canteen for Entrar
// @version 1
// @include https://entrar.in/*
// @grant none
// ==/UserScript==
// Get admission number
var admid = document.getElementById("welcome-user").innerText.split('\n')[2].replace('/', '')
const path = require('node:path');
const bdb = require('bdb');
const bio = require('bufio');
const MasterKey = require('hsd/lib/wallet/masterkey');
const layouts = require('hsd/lib/wallet/layout');
const layout = layouts.wdb;
// SET THESE VALUES:
const FILTER_SECRETS = true;
const HSD_DATA_LOC = '/path/to/any/hsd_data';
#!/bin/bash
declare -a tlds=("aaa" "aarp" "abarth" "abb" "abbott" "abbvie" "abc" "able" "abogado" "abudhabi" "ac" "academy" "accenture" "accountant" "accountants" "aco" "actor" "ad" "adac" "ads" "adult" "ae" "aeg" "aero" "aetna" "af" "afl" "africa" "ag" "agakhan" "agency" "ai" "aig" "airbus" "airforce" "airtel" "akdn" "al" "alfaromeo" "alibaba" "alipay" "allfinanz" "allstate" "ally" "alsace" "alstom" "am" "amazon" "americanexpress" "americanfamily" "amex" "amfam" "amica" "amsterdam" "analytics" "android" "anquan" "anz" "ao" "aol" "apartments" "app" "apple" "aq" "aquarelle" "ar" "arab" "aramco" "archi" "army" "arpa" "art" "arte" "as" "asda" "asia" "associates" "at" "athleta" "attorney" "au" "auction" "audi" "audible" "audio" "auspost" "author" "auto" "autos" "avianca" "aw" "aws" "ax" "axa" "az" "azure" "ba" "baby" "baidu" "banamex" "bananarepublic" "band" "bank" "bar" "barcelona" "barclaycard" "barclays" "barefoot" "bargains" "baseball" "basketball" "bauhaus" "bayern" "bb" "bbc" "bbt" "bbva" "bcg" "bcn" "bd"
@rithvikvibhu
rithvikvibhu / batch-regtest-setup.js
Created August 19, 2022 12:54
Bob setup chain for testing
// Based on hsd/test/wallet-auction-test.js (hsd 686, #764)
// Opens 800 names and places 2 bids per name
// After running this, refresh Bob and try other bulk actions (reveal all, etc.)
const { WalletClient, NodeClient } = require('hs-client');
const { Address, Network } = require('hsd');
// Edit these:
const NETWORK = 'regtest';
const API_KEY = 'apikey';
// USAGE: hsd --log-console=false --plugins=/path/to/this/file/renewal-count-plugin.js
'use strict';
const fs = require('fs').promises;
const layout = require('hsd/lib/blockchain/layout');
const { types } = require('hsd/lib/covenants/rules');
const TXMeta = require('hsd/lib/primitives/txmeta');
const plugin = exports;
@rithvikvibhu
rithvikvibhu / create-open-bid-reveal.js
Created August 27, 2021 18:58
Pre-signed OPEN, BID, REVEAL transactions
/**
* Generate pre-signed OPEN, BID, REVEAL transactions
*
* TX 1 (immediately broadcast):
* 1 (or more) coin (100 HNS) -----> OPEN name/ (0 HNS)
* \----> addr2 (lockup value = 70.1)
* \----> change (29.9 HNS - fee)
*
* TX 2 (broadcast in BIDDING period):
* addr2 (70.1 HNS) -----> BID name/ (70)