Skip to content

Instantly share code, notes, and snippets.

View anibali's full-sized avatar

Aiden Nibali anibali

View GitHub Profile
@victor-shepardson
victor-shepardson / pytorch-glumpy.py
Last active March 25, 2024 19:47
using pycuda and glumpy to draw pytorch GPU tensors to the screen without copying to host memory
from contextlib import contextmanager
import numpy as np
import torch
from torch import Tensor, ByteTensor
import torch.nn.functional as F
from torch.autograd import Variable
import pycuda.driver
from pycuda.gl import graphics_map_flags
from glumpy import app, gloo, gl
@flesser
flesser / svg-compress-embedded-png.py
Last active July 1, 2017 03:19
Compress embedded png images to jpg in SVG files. (based on https://gist.github.com/jeromerobert/ff34f504acd7feb0306a)
#! /usr/bin/env python
import xml.etree.ElementTree as ET
import sys
import base64
import os
import StringIO
from PIL import Image
@joakin
joakin / git-find-me-the-fucking-deleted-file.sh
Last active May 2, 2024 07:41
finding a deleted file in a git repository
# If you don't remember the exact path/name, search the log for deleted files
git log --diff-filter=D --summary | grep delete
# Find the file you want to get from the ouput, and use the path
# Find the commits that involved that path
git log --all -- some/path/to/deleted.file
# Bring the file back to life to the current repo (sha commit of parent of commit that deleted)
git checkout shaofthecommitthatdeletedthefile^ -- some/path/to/deleted.file
@brundage
brundage / database.yml
Created November 16, 2012 22:05
Use sqlite in-memory database for rspec testing
test:
adapter: sqlite3
encoding: utf8
pool: 5
timeout: 5000
database: ":memory:"
verbosity: quiet
@postmodern
postmodern / c_parser.rb
Created January 16, 2011 04:24
An ANSI C Parser using the Ruby Parslet library.
#
# A C Parser using the Parslet library.
#
# ANSI C Grammar:
#
# * http://www.lysator.liu.se/c/ANSI-C-grammar-l.html
# * http://www.lysator.liu.se/c/ANSI-C-grammar-y.html
#
require 'parslet'