Skip to content

Instantly share code, notes, and snippets.

@timelf123
timelf123 / index.js
Created January 24, 2018 13:22
Generate ETH address with 00 at the end.
const Web3 = require('web3');
const provider = new Web3.providers.HttpProvider('http://localhost:8549');
const web3 = new Web3(provider);
let acc = web3.eth.accounts.create();
let last = acc.address[acc.address.length-2];
let last2 = acc.address.slice(acc.address.length - 2, acc.address.length );
console.log(last2);
while(last2 != '00' ){
@timelf123
timelf123 / export_repo_issues_to_csv.py
Created January 23, 2018 20:27 — forked from mmoelli/export_repo_issues_to_csv.py
[python] Fetch Issues from GitHub API (v3) with Auth token and put them into a CSV
"""
Exports Issues from a list of specified repository to a CSV file
Credits go to https://gist.github.com/unbracketed/3380407#file-export_repo_issues_to_csv-py for the initial work, but I had to adjust it a bit
FYI: you need to install 'requests' before, best via pip: "$ sudo pip installs requests"
"""
import csv
import requests
@timelf123
timelf123 / getnames.py
Created January 23, 2018 04:25 — forked from ErikBoesen/getnames.py
Given a file ./tokens.txt containing many Discord bot tokens, this script will attempt login with each, and write valid tokens (plus their names and how many servers they're in) to ./valid.csv.
import discord
import asyncio
class Bot(discord.Client):
def __init__(self, token):
super().__init__()
self.token = token
print('%s->' % token, end='')
async def on_ready(self):
@timelf123
timelf123 / base.Dockerfile
Created December 3, 2017 18:54 — forked from alexellis/base.Dockerfile
Docker swarm service to mine into the Nice Hash pool
# Published on Docker Hub with above user alexellisio.
# If you want to rebuild your own copy, follow below instructions
# Build this on each type of machine so you have the correct CPU extensions.
FROM alexellisio/boostbase
RUN git clone -b Linux https://github.com/nicehash/nheqminer.git
RUN cd nheqminer/cpu_xenoncat/Linux/asm/ && sh assemble.sh && cd ../../../Linux_cmake/nheqminer_cpu && cmake . && make
ENTRYPOINT ["./nheqminer/Linux_cmake/nheqminer_cpu/nheqminer_cpu"]
@timelf123
timelf123 / description.md
Created September 22, 2017 14:08 — forked from honza/description.md
Ranking algorithm - Lower bound of Wilson score confidence interval for a Bernoulli parameter All implementations use 95% probability.

Ranking algorithm

Lower bound of Wilson score confidence interval for a Bernoulli parameter

All implementations use 95% probability.

pos is the number of positive votes, n is the total number of votes.

Source

@timelf123
timelf123 / lower_bound.js
Created September 22, 2017 14:08 — forked from Gattermeier/lower_bound.js
Lower bound of Wilson score confidence interval for a Bernoulli parameter
// Node.js implementation of Evan Miller's algorithm for ranking stuff based on upvotes:
// http://www.evanmiller.org/how-not-to-sort-by-average-rating.html
const stats = require('simple-statistics')
const lower_bound = (upvotes, n = 0, confidence = 0.95) => {
if (n === 0) return 0
// for performance purposes you might consider memoize the calcuation for z
const z = stats.probit(1-(1-confidence)/2)
@timelf123
timelf123 / aggregation_lookup.md
Created September 5, 2017 20:28 — forked from bertrandmartel/aggregation_lookup.md
MongoDB $lookup aggregation example

MongoDB $lookup aggregation

SO link

db.votes.aggregate([{
    $lookup: {
        from: "users",
        localField: "createdBy",
        foreignField: "_id",
@timelf123
timelf123 / docker-gc
Created September 3, 2017 03:59 — forked from osiyuk/docker-gc
free up disk space after docker garbage
#!/bin/bash
GARBAGE="/var/lib/docker/aufs/diff"
du -hd 1 $GARBAGE | sort -hrk 1 | head -25
find $GARBAGE -maxdepth 1 -name *-removing -exec rm -rf '{}' \;
@timelf123
timelf123 / excel2html.htm
Created August 8, 2017 20:31 — forked from andyj/excel2html.htm
Paste Excel in to HTML to create at <table>
<html>
<head>
<style>
*{
font-family: arial;
font-size: 11px;
}
table{
border-collapse: collapse;
border: 1px solid silver;
@timelf123
timelf123 / gist:6580922e692f4dfacfbefa9d2d3c81f7
Created August 8, 2017 20:31 — forked from shapiromatron/gist:5024948
Convert an Excel Range to a Bootstrap HTML table
' Example function call: =BuildHTMLTable(A1:D5)
Public Function BuildHTMLTable(rng As Range) As String
' Given a Range of Cells, build a Bootstrap HTML table, using the formatting
' specified in the Excel cells. If "header" is specified to equal true, assumes
' the first row in the table is a header row.
Dim last_r As Long: last_r = rng.Cells(1, 1).Row
Dim tds As New Collection
Dim txt As String
Dim isFirstRow As Boolean: isFirstRow = True