Skip to content

Instantly share code, notes, and snippets.

Barend bvanrijn

Block or report user

Report or block bvanrijn

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View sieve.py
from math import floor, sqrt
from typing import List
def sieve(n: int) -> List[int]:
A: List[bool] = [True] * n
for i in range(2, floor(sqrt(n) + 1), 1):
if A[i]:
for j in range(i ** 2, n, i):
@bvanrijn
bvanrijn / README.md
Last active Apr 5, 2020
This is the wordlist from http://codekata.com/data/wordlist.txt with fixed accents.
View README.md

wordlist.txt

This is the wordlist from codekata.com/data/wordlist.txt with fixed accents. The original uses Windows-1252, which leads to some accents being replaced with the [Unicode replacement character][2]. Once I remembered how to, it was easily fixed using [Visual Studio Code][3], and I thought I'd upload the word list here for anyone else who might need it.

(🤓🎉: [git.io/wordlist.txt][4] [links here][5])

@bvanrijn
bvanrijn / build.md
Last active Feb 26, 2020
How to build Ruby from source on Ubuntu 18.04
View build.md

⚠️ Warning: This will install an unstable version of Ruby with the latest changes.

apt update
apt install autoconf bison build-essential gcc git libedit-dev libffi-dev libgdbm-dev libqdbm-dev libreadline-dev libssl-dev make ruby zlib1g-dev
git clone --depth 1 https://github.com/ruby/ruby
cd ruby
autoconf
./configure
make
@bvanrijn
bvanrijn / bench.txt
Created May 27, 2018 — forked from gabrielhpugliese/bench.txt
Python 3.4 asyncio + aiohttp parallel vs sequential requests
View bench.txt
$python parallel.py
[13:48:59:130701] Doing GET request to http://google.com
[13:48:59:134958] Doing GET request to http://facebook.com
[13:48:59:135498] Doing GET request to http://twitter.com
[13:48:59:136174] Doing GET request to http://slack.com
****** STATUSES: [{'status': 200, 'url': 'http://google.com'}, {'status': 200, 'url': 'http://twitter.com'}, {'status': 200, 'url': 'http://slack.com'}, {'status': 200, 'url': 'http://facebook.com'}]
$python sequential.py
[13:49:04:078752] Doing GET request to http://google.com
[13:49:04:232725] Doing GET request to http://facebook.com
View snakecoin.py
import hashlib as hasher
import datetime as date
# Define what a Snakecoin block is
class Block:
def __init__(self, index, timestamp, data, previous_hash):
self.index = index
self.timestamp = timestamp
self.data = data
self.previous_hash = previous_hash
@bvanrijn
bvanrijn / talkingbots.py
Last active Dec 14, 2016
Talking bots. Oh, my!
View talkingbots.py
from urllib.parse import quote_plus
import requests
import time
class bot():
def __init__(self, name):
self.name = name
self.text = ''
self.said = []
@bvanrijn
bvanrijn / bot.py
Last active Dec 6, 2016
blink(1) telegram bot
View bot.py
import time
import tempfile
import logging
import requests
from colorthief import ColorThief
from blink1.blink1 import Blink1
from telegram.ext import Updater, MessageHandler, Filters
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
View recursive-fibonacci.go
package main
import "fmt"
func F(n int) int {
if n == 0 { return 0 }
if n == 1 { return 1 }
return F(n-2) + F(n-1)
}
View xh-system-convert.py
# -*- coding: utf-8 -*-
'''
usage: python xh-system-convert.py FILE
Converts X or H system to Esperanto alphabet characters in FILE
Written by @grooveplex, released into the public domain under the terms of the
CC0 license.
'''
View mdl.css
body{
font-family: Roboto, sans-serif;
background: #2196f3;
}
.top{
background: #1976d2;
height: 150px;
-webkit-box-shadow: 0px 1px 8px #2c2c2c;
-moz-box-shadow: 0px 1px 8px #2c2c2c;
-ms-box-shadow: 0px 1px 8px #2c2c2c;
You can’t perform that action at this time.