Skip to content

Instantly share code, notes, and snippets.

View metrofun's full-sized avatar

Dmytrii S. metrofun

View GitHub Profile
@metrofun
metrofun / colabpt2
Created October 20, 2020 19:09 — forked from muellerzr/colabpt2
perl -pi -e 's|execution_count": null|execution_count": 1|g' course-v4/nbs/*ipynb
nohup jupyter notebook --no-browser --allow-root --ip=0.0.0.0&
@metrofun
metrofun / bash3.sh
Created October 20, 2020 19:05 — forked from muellerzr/bash3.sh
kill $(ps aux | grep './ngrok' | awk '{print $2}')
@metrofun
metrofun / colabpt1v3
Last active October 20, 2020 19:07 — forked from muellerzr/colabpt1v3
echo Setting up server...
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -q
sudo apt-get install -y nodejs -q
pip install jupyter jupyterlab --upgrade -q
pip install jupyter_contrib_nbextensions && jupyter contrib nbextension install -q
wget -q -c -nc https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip
unzip -qq -n ngrok-stable-linux-amd64.zip
@metrofun
metrofun / latency.txt
Created March 2, 2020 19:24 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
from mxnet import nd, io
class RBM(object):
"""Bernoulli Restricted Boltzmann Machine (RBM) implementation using MXNET
"""
def __init__(self, weights=None, hidden_bias=None, visible_bias=None,):
assert isinstance(weights, nd.NDArray)
if visible_bias is not None:
assert visible_bias.shape == (1, weights.shape[0])
if hidden_bias is not None:
@metrofun
metrofun / getBase64FromImage.js
Last active August 1, 2023 11:43
Script to convert image into base64, using xhr2 without canvas. Therefore it is possible to convert images from another domains, using CORS.
function getBase64FromImage(url, onSuccess, onError) {
var xhr = new XMLHttpRequest();
xhr.responseType = "arraybuffer";
xhr.open("GET", url);
xhr.onload = function () {
var base64, binary, bytes, mediaType;
bytes = new Uint8Array(xhr.response);
@metrofun
metrofun / .zshrc
Created March 26, 2013 15:10 — forked from SlexAxton/.zshrc
gifify() {
if [[ -n "$1" ]]; then
if [[ $2 == '--good' ]]; then
ffmpeg -i $1 -r 10 -vcodec png out-static-%05d.png
time convert -verbose +dither -layers Optimize -resize 600x600\> out-static*.png GIF:- | gifsicle --colors 128 --delay=5 --loop --optimize=3 --multifile - > $1.gif
rm out-static*.png
else
ffmpeg -i $1 -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > $1.gif
fi
else

This is an updated fork of the gist located here: https://gist.github.com/2254924

Backstory: I decided to crowdsource static site generator recommendations, so the following are actual real world suggested-to-me results. I then took those and sorted them by language/server and, just for a decent relative metric, their Github Watcher count. If you want a heap of other projects (including other languages like Haskell and Python) Nanoc has the mother of all site generator lists. If you recommend another one, by all means add a comment.

Ruby

@metrofun
metrofun / gist:1146034
Created August 15, 2011 10:56
VirtualHost sample
<VirtualHost *:80>
ServerName flexidoll
ServerAdmin metrofun@i.ua
ErrorLog /home/metrofun/Dev/sites/flexidoll/apache_error.log
DocumentRoot /home/metrofun/Dev/sites/flexidoll/
<Directory /home/metrofun/Dev/sites/flexidoll/>
AllowOverride All
</Directory>
</VirtualHost>