Skip to content

Instantly share code, notes, and snippets.

View floringogianu's full-sized avatar
🐳
Chasing Moby-Dick

Florin Gogianu floringogianu

🐳
Chasing Moby-Dick
View GitHub Profile
@tomerfiliba
tomerfiliba / gist:3698403
Created September 11, 2012 13:20
get the indexes of the top n elements in a numpy 2d-array
import numpy as np
import bottleneck as bn
def top_n_indexes(arr, n):
idx = bn.argpartsort(arr, arr.size-n, axis=None)[-n:]
width = arr.shape[1]
return [divmod(i, width) for i in idx]
np.random.seed(47)
@grenade
grenade / 01-generate-ed25519-ssh-key.sh
Last active November 9, 2024 20:40
generate ed25519 ssh and gpg/pgp keys and set file permissions for ssh keys and config
#!/bin/bash
# generate new personal ed25519 ssh keys
ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/id_ed25519 -C "rob thijssen <[email protected]>"
ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/id_robtn -C "rob thijssen <[email protected]>"
# generate new host cert authority (host_ca) ed25519 ssh key
# used for signing host keys and creating host certs
ssh-keygen -t ed25519 -f manta_host_ca -C manta.network
@nijikokun
nijikokun / about.md
Last active April 5, 2017 13:31
Credit Card Validation & Credit Card Type Check & Credit Card Cleaner & Credit Card Security Code Validator. Framework Agnostic.

credit-card.js

Allows you to easily validate, clean, check type of card based on number, and verify the security code. It's small, has the fastest luhn implementation, works for all major cards without complex expressions, framework agnostic, and doesn't cost your company a small fortune to use like other libraries.

Easily hook it up to any framework, any code, easy to port.

Usage

Type

@staltz
staltz / introrx.md
Last active November 17, 2024 01:08
The introduction to Reactive Programming you've been missing
@akolosov
akolosov / gist:cedaac86b333a4ced95f
Last active December 23, 2019 03:46
vim 7.4 with lua+GUI on Ubuntu 14.04
#!/bin/sh
sudo apt-get remove --purge vim vim-runtime vim-gnome vim-tiny vim-common vim-gui-common
sudo apt-get install liblua5.1-dev luajit libluajit-5.1 python-dev ruby-dev libperl-dev mercurial libncurses5-dev libgnome2-dev libgnomeui-dev libgtk2.0-dev libatk1.0-dev libbonoboui2-dev libcairo2-dev libx11-dev libxpm-dev libxt-dev
sudo mkdir /usr/include/lua5.1/include
sudo ln -s /usr/include/luajit-2.0 /usr/include/lua5.1/include
cd ~
hg clone https://code.google.com/p/vim/
@karpathy
karpathy / min-char-rnn.py
Last active November 16, 2024 23:10
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@fish830617
fish830617 / null.py
Created January 5, 2016 16:01
Calculate the null space of a matrix by QR factorization.
# null.py
import numpy as np
from scipy.linalg import qr
def qr_null(A, tol=None):
Q, R, P = qr(A.T, mode='full', pivoting=True)
tol = np.max(A) * np.finfo(R.dtype).eps if tol is None else tol
rnk = min(A.shape) - np.abs(np.diag(R))[::-1].searchsorted(tol)
return Q[:, rnk:].conj()
@jcjohnson
jcjohnson / fc_benchmark.lua
Last active April 20, 2016 11:09
Simple torch benchmarking tool for fully-connected networks
require 'nn'
require 'cutorch'
require 'cunn'
--[[
-- A simple benchmark comparing fully-connected net times on CPU and GPU.
--
-- Note that we don't count time it takes to transfer data to the GPU.
--]]
@jimfleming
jimfleming / Ornstein-Uhlenbeck.ipynb
Last active December 7, 2020 16:09
Summary of the Ornstein–Uhlenbeck process.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@awjuliani
awjuliani / Deep-Recurrent-Q-Network.ipynb
Last active July 18, 2023 19:18
An implementation of a Deep Recurrent Q-Network in Tensorflow.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.