Skip to content

Instantly share code, notes, and snippets.

@tuuzdu
tuuzdu / hamachi.nix
Last active June 21, 2020 10:31
Nix hamachi aarch64
{ stdenv, fetchurl }:
with stdenv.lib;
let
arch =
if stdenv.hostPlatform.system == "x86_64-linux" then "x64"
else if stdenv.hostPlatform.system == "i686-linux" then "x86"
else if stdenv.hostPlatform.system == "aarch64-linux" then "armhf"
else throwSystem;
@stormraiser
stormraiser / danbooru_faces.md
Last active January 21, 2023 16:57
Danbooru Faces dataset

Danbooru Faces v0.1

Discription

This dataset contains ~443k anime face images of size 256x256 drawn by ~7,000 artists, obtained from Danbooru

Collection

We first downloaded JSON files of all existing posts numbered from 1 to 2,800,000 using their API. We filtered the posts by the following criteria:

@jganzabal
jganzabal / Nvidia Titan XP + MacBook Pro + Akitio Node + Tensorflow + Keras.md
Last active July 10, 2025 15:43
How to setup Nvidia Titan XP for deep learning on a MacBook Pro with Akitio Node + Tensorflow + Keras
@joelthchao
joelthchao / demo.py
Last active August 31, 2021 18:02
Keras uses TensorBoard Callback with train_on_batch
import numpy as np
import tensorflow as tf
from keras.callbacks import TensorBoard
from keras.layers import Input, Dense
from keras.models import Model
def write_log(callback, names, logs, batch_no):
for name, value in zip(names, logs):
summary = tf.Summary()
@t-ae
t-ae / pixel_shuffler.py
Last active January 23, 2024 02:02
PixelShuffler layer for Keras
"""
The MIT License (MIT)
Copyright (c) 2018 Takehiro Araki.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@cbaziotis
cbaziotis / Attention.py
Last active October 22, 2024 08:31
Keras Layer that implements an Attention mechanism for temporal data. Supports Masking. Follows the work of Raffel et al. [https://arxiv.org/abs/1512.08756]
from keras import backend as K, initializers, regularizers, constraints
from keras.engine.topology import Layer
def dot_product(x, kernel):
"""
Wrapper for dot product operation, in order to be compatible with both
Theano and Tensorflow
Args:
@jacky860226
jacky860226 / DC3.cpp
Last active October 11, 2025 05:24
Suffix Array + Longest Common Prefix
/**
* DC3 (Difference Cover 3) 後綴陣列構造算法
*
* 算法原理:
* 1. 將所有後綴分為三類:Type A (i%3==0), Type B1 (i%3==1), Type B2 (i%3==2)
* 2. 遞歸處理 Type B 後綴(佔總數的 2/3)
* 3. 利用 Type B 的排序結果來排序 Type A 後綴
* 4. 歸併 Type A 和 Type B 得到完整的後綴陣列
*
* 時間複雜度分析:
@amchercashin
amchercashin / CUDnn.conf
Last active July 31, 2018 11:34
Permanently add CUDA lib to enviroment. Create CUDnn.conf at /etc/ld.so.conf.d/CUDnn.conf then run seconf scrypt
/usr/local/cuda/lib64
@udibr
udibr / beamsearch.py
Last active October 4, 2021 11:50
beam search for Keras RNN
# variation to https://github.com/ryankiros/skip-thoughts/blob/master/decoding/search.py
def keras_rnn_predict(samples, empty=empty, rnn_model=model, maxlen=maxlen):
"""for every sample, calculate probability for every possible label
you need to supply your RNN model and maxlen - the length of sequences it can handle
"""
data = sequence.pad_sequences(samples, maxlen=maxlen, value=empty)
return rnn_model.predict(data, verbose=0)
def beamsearch(predict=keras_rnn_predict,
@ryerh
ryerh / tmux-cheatsheet.markdown
Last active December 15, 2025 13:11 — forked from MohamedAlaa/tmux-cheatsheet.markdown
Tmux 快捷键 & 速查表 & 简明教程

注意:本文内容适用于 Tmux 2.3 及以上的版本,但是绝大部分的特性低版本也都适用,鼠标支持、VI 模式、插件管理在低版本可能会与本文不兼容。

Tmux 快捷键 & 速查表 & 简明教程

启动新会话:

tmux [new -s 会话名 -n 窗口名]

恢复会话: