Skip to content

Instantly share code, notes, and snippets.

@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
@timelf123
timelf123 / beguidcalc.md
Created August 1, 2017 17:10 — forked from klemmchr/beguidcalc.md
ArmA 3 / DayZ-Standalone - BattlEye GUID calculation

md5("BE" (2 bytes) + 64-bit SteamID (8 bytes))

<?xml version="1.0" encoding="utf-8"?>
<html>
<!--Created by Arma 3 Launcher: https://arma3.com-->
<head>
<meta name="arma:Type" content="preset" />
<meta name="arma:PresetName" content="overthrow rhs" />
<meta name="generator" content="Arma 3 Launcher - https://arma3.com" />
<title>Arma 3 Mods</title>
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet" type="text/css" />
<style>
@timelf123
timelf123 / multiple_ssh_setting.md
Last active June 21, 2017 19:39 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "[email protected]"

What if a package did something like this, but instead of logging to the console, they sent it back to a server?

Have you actually reviewed every dependency and every child dependency in every app you deploy?

Why are people not more scared of this?

Analytics

@timelf123
timelf123 / 144
Created May 17, 2017 18:27 — forked from akyoto/144
Ubuntu + Nvidia + 144 Hz monitor
# Put this in your startup scripts
xrandr --output DVI-D-0 --mode 1920x1080 --rate 144
# In order to find the correct parameters for the above command run:
xrandr -q