Skip to content

Instantly share code, notes, and snippets.

skeeet /
Created Apr 12, 2012 — forked from MaximKeegan/
Create a RAM disk for using with XCode
# Create a RAM disk with same perms as mountpoint
# Script based on with some additions
# Usage: sudo ./ start
A weighted version of categorical_crossentropy for keras (1.1.0). This lets you apply a weight to unbalanced classes.
@author: wassname
from keras import backend as K
class weighted_categorical_crossentropy(object):
A weighted version of keras.objectives.categorical_crossentropy
skeeet /
Created Nov 27, 2020 — forked from alper111/
PyTorch implementation of Laplacian pyramid loss
import torch
def gauss_kernel(size=5, device=torch.device('cpu'), channels=3):
kernel = torch.tensor([[1., 4., 6., 4., 1],
[4., 16., 24., 16., 4.],
[6., 24., 36., 24., 6.],
[4., 16., 24., 16., 4.],
[1., 4., 6., 4., 1.]])
kernel /= 256.
kernel = kernel.repeat(channels, 1, 1, 1)
skeeet / mlSpeedTests.swift
Created May 19, 2020 — forked from akirasosa/mlSpeedTests.swift
Benchmark Core ML model in iOS.
View mlSpeedTests.swift
import CoreML
import XCTest
@testable import mlsample
class mlsampleTests: XCTestCase {
override func setUp() {
skeeet /
Created Apr 27, 2020 — forked from smoser/
Boot a specific installed Ubuntu kernel using grub-reboot and grub-set-default

Ubuntu Grub Boot Kernel

Boot a specific installed Ubuntu kernel using grub-reboot and grub-set-default.

This allows you to pick what kernel you want to boot on next reboot, or set the default, without having to know much about how grub works or editing config files.


  Usage: boot-kernel [options] [kernel]

call grub-reboot or grub-set-default to boot the provided kernel.

skeeet / .tmux.conf
Created Nov 3, 2019 — forked from paulodeleo/.tmux.conf
Tmux configuration to enable mouse scroll and mouse panel select, taken from:
View .tmux.conf
# Make mouse useful in copy mode
setw -g mode-mouse on
# Allow mouse to select which pane to use
set -g mouse-select-pane on
# Allow mouse dragging to resize panes
set -g mouse-resize-pane on
# Allow mouse to select windows
skeeet / CMakeLists.txt
Created Apr 1, 2019 — forked from zeryx/CMakeLists.txt
minimal pytorch 1.0 pytorch -> C++ full example demo image at:
View CMakeLists.txt
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
set(CMAKE_PREFIX_PATH ../libtorch)
find_package(Torch REQUIRED)
find_package(OpenCV REQUIRED)
add_executable(testing main.cpp)
message(STATUS "OpenCV library status:")
message(STATUS " config: ${OpenCV_DIR}")
skeeet /
Created Feb 20, 2019 — forked from stormraiser/
Danbooru Faces dataset

Danbooru Faces v0.1


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


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:

skeeet /
Created Feb 20, 2019 — forked from MFreidank/
A pytorch DataLoader that generates an unbounded/infinite number of minibatches from the dataset.
from import DataLoader
class InfiniteDataLoader(DataLoader):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# Initialize an iterator over the dataset.
self.dataset_iterator = super().__iter__()
def __iter__(self):
skeeet /
Created May 5, 2017 — forked from bzamecnik/model_summary.txt
Residual LSTM in Keras
def make_residual_lstm_layers(input, rnn_depth, rnn_dropout):
The intermediate LSTM layers return sequences, while the last returns a single element.
The input is also a sequence. In order to match the shape of input and output of the LSTM
to sum them we can do it only for all layers but the last.
for i in range(rnn_depth):
return_sequences = i < rnn_depth - 1
x_rnn = LSTM(rnn_width, dropout_W=rnn_dropout, dropout_U=rnn_dropout, return_sequences=return_sequences)(input)
if return_sequences: