Skip to content

Instantly share code, notes, and snippets.

Avatar

Helder S Ribeiro hsribei

View GitHub Profile
@hsribei
hsribei / npm-yarn-global-without-sudo.md
Created May 4, 2017
Remove need for sudo for npm install -g and yarn global add
View npm-yarn-global-without-sudo.md
@hsribei
hsribei / teachable-markdown-example.min.js
Last active Nov 14, 2018
Sample code to render markdown client-side on Teachable
View teachable-markdown-example.min.js
parcelRequire=function(e,r,n,t){var i="function"==typeof parcelRequire&&parcelRequire,o="function"==typeof require&&require;function u(n,t){if(!r[n]){if(!e[n]){var f="function"==typeof parcelRequire&&parcelRequire;if(!t&&f)return f(n,!0);if(i)return i(n,!0);if(o&&"string"==typeof n)return o(n);var c=new Error("Cannot find module '"+n+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[n][1][r]||r},p.cache={};var l=r[n]=new u.Module(n);e[n][0].call(l.exports,p,l,l.exports,this)}return r[n].exports;function p(e){return u(p.resolve(e))}}u.isParcelRequire=!0,u.Module=function(e){this.id=e,this.bundle=u,this.exports={}},u.modules=e,u.cache=r,u.parent=i,u.register=function(r,n){e[r]=[function(e,r){r.exports=n},{}]};for(var f=0;f<n.length;f++)u(n[f]);if(n.length){var c=u(n[n.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=c:"function"==typeof define&&define.amd?define(function(){return c}):t&&(this[t]=c)}return u}({"5bmg":[function(require,module,exports) {
"use stric
@hsribei
hsribei / can-nat-traversal-be-tor-s-killer-feature.md
Last active Jul 12, 2018
Can NAT traversal be Tor's killer feature?
View can-nat-traversal-be-tor-s-killer-feature.md

Can NAT traversal be Tor's killer feature?

tl;dr: how about a virtual global flat LAN that maps static IPs to onion addresses?

[We all know the story][1]. Random feature gets unintentionally picked up as the main reason for buying/using a certain product, despite the creator's intention being different or more general. (PC: spreadsheets; Internet: porn; smartphones: messaging.)

@hsribei
hsribei / get-files-recursive-sync.js
Created Jul 11, 2018
List files recursively in nodejs then do some ad-hoc filtering and renaming
View get-files-recursive-sync.js
const fs = require('fs')
const path = require('path')
const child_process = require('child_process')
function getFilesRecursiveSync(folder) {
const fileContents = fs.readdirSync(folder)
return fileContents.reduce(function(matches, fileName) {
const filePath = path.join(folder, fileName)
const stats = fs.lstatSync(filePath)
@hsribei
hsribei / offline-emoji.md
Created Nov 26, 2017
Offline / no signal / lost connection emoji sequence
View keybase.md

Keybase proof

I hereby claim:

  • I am hsribei on github.
  • I am hsribei (https://keybase.io/hsribei) on keybase.
  • I have a public key whose fingerprint is CE60 7647 EE99 E678 D4BB 509A BDEE B41F 5ACF CF91

To claim this, I am signing this object:

@hsribei
hsribei / putting-the-tor-back-in-torrent.md
Last active Jan 18, 2017
Putting the "Tor" back in Torrent
View putting-the-tor-back-in-torrent.md

Putting the "Tor" back in Torrent

How a Popcorn Time fork patch could incentivize people to run thousands of new Tor relays

This is a follow-up to this discussion: Can NAT traversal be Tor's killer feature?

If torrents are P2P's killer application, and NAT traversal/"static IP" are Tor's (via hidden services), putting them together could prove to be the best incentivization scheme for growing the Tor network other than cold crypto cash.

You're stupid

Everybody knows you're not supposed to use torrents with tor, right?

@hsribei
hsribei / parse-url-params.js
Created Nov 25, 2012
Parse url parameters from any string given or from current URL otherwise
View parse-url-params.js
// Adapted from http://stackoverflow.com/a/901144/105132
function parseUrlParams(queryString) {
var params = {},
match,
pl = /\+/g, // Regex for replacing addition symbol with a space
search = /([^&=]+)=?([^&]*)/g,
decode = function (s) { return decodeURIComponent(s.replace(pl, " ")); },
query = queryString || window.location.search.substring(1);
@hsribei
hsribei / findPropertyValue.js
Created Nov 25, 2012
Find a property that has a certain value and return its object path starting at the root object parameter
View findPropertyValue.js
// FIXME: this can very rapidly hit the call stack size limit
function findPropertyValue(obj, value) {
if (typeof obj.seenBefore === "undefined") {
// treat for object graph circularity
obj.seenBefore = true;
for (var key in obj) {
if (obj[key] == value) {
return key;
@hsribei
hsribei / gist:1318423
Created Oct 27, 2011
A Recorder/Code generator for FireWatir
View gist:1318423
Abstract
========
This project aims at allowing users to record normal usage on a
website and then have a script generated that can reproduce such
actions.
This script is generated in Ruby and can be changed and mixed with
existing Ruby code to extend its behaviour, using regular Ruby
variables, loop constructs, etc.