Skip to content

Instantly share code, notes, and snippets.

View bermanmaxim's full-sized avatar

Maxim Berman bermanmaxim

View GitHub Profile
@ryin
ryin / tmux_local_install.sh
Last active July 13, 2024 00:42
bash script for installing tmux without root access
#!/bin/bash
# Script for installing tmux on systems where you don't have root access.
# tmux will be installed in $HOME/local/bin.
# It's assumed that wget and a C/C++ compiler are installed.
# exit on error
set -e
TMUX_VERSION=1.8
@tassoevan
tassoevan / transparent-window.py
Last active November 3, 2017 03:16
Transparent window for WebView (WebKit) in Python (in progress)
import sys
from gi.repository import Gtk, Gdk, WebKit
class WebKitWindow(Gtk.Window):
scrolls = None
webView = None
def __init__(self, url, transparent=False):
Gtk.Window.__init__(self, Gtk.WindowType.TOPLEVEL, title='')
self.scrolls = Gtk.ScrolledWindow()
@fmassa
fmassa / convertLinear2Conv1x1.lua
Last active May 30, 2018 20:16
Simple example on how to convert a Linear model to a 1x1 convolution
require 'nn'
-- you just need to provide the linear module you want to convert,
-- and the dimensions of the field of view of the linear layer
function convertLinear2Conv1x1(linmodule,in_size)
local s_in = linmodule.weight:size(2)/(in_size[1]*in_size[2])
local s_out = linmodule.weight:size(1)
local convmodule = nn.SpatialConvolutionMM(s_in,s_out,in_size[1],in_size[2],1,1)
convmodule.weight:copy(linmodule.weight)
convmodule.bias:copy(linmodule.bias)
@karpathy
karpathy / min-char-rnn.py
Last active July 29, 2024 00:13
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)
@wllhf
wllhf / VOClabelcolormap.py
Last active March 28, 2024 09:11
Python implementation of the color map function for the PASCAL VOC data set.
"""
Python implementation of the color map function for the PASCAL VOC data set.
Official Matlab version can be found in the PASCAL VOC devkit
http://host.robots.ox.ac.uk/pascal/VOC/voc2012/index.html#devkit
"""
import numpy as np
from skimage.io import imshow
import matplotlib.pyplot as plt
def color_map(N=256, normalized=False):
@anantzoid
anantzoid / pixelcnn_decoder.md
Created November 19, 2016 08:14
Summary for Conditional Image Generation with PixelCNN Decoder

Conditional Image Generation with PixelCNN Decoder

Implemenetation:

What

  • New image density model based on PixelCNN
  • Can generate variety of images from text embeddings or CNN layer weights
  • Serves as decoder in image autoencoder
  • Gated PixelCNN: Matches PixelRNN accuracy
@eyalroz
eyalroz / get_cuda_sm.sh
Created April 15, 2017 20:28
Shell script for determining the SM value for your (single) GPU
#!/bin/bash
#
# Prints the compute capability of the first CUDA device installed
# on the system, or alternatively the device whose index is the
# first command-line argument
device_index=${1:-0}
timestamp=$(date +%s.%N)
gcc_binary=${CMAKE_CXX_COMPILER:-$(which c++)}
cuda_root=${CUDA_DIR:-/usr/local/cuda}
@magicdude4eva
magicdude4eva / zsh-syntax-highlighting paste performance improvement
Last active July 1, 2024 15:05
zsh-syntax-highlighting paste performance improvement
Add the following in .zshrc:
...
plugins=(osx git zsh-autosuggestions zsh-syntax-highlighting zsh-nvm docker kubectl)
...
### Fix slowness of pastes with zsh-syntax-highlighting.zsh
pasteinit() {
OLD_SELF_INSERT=${${(s.:.)widgets[self-insert]}[2,3]}
zle -N self-insert url-quote-magic # I wonder if you'd need `.url-quote-magic`?