Skip to content

Instantly share code, notes, and snippets.

View saurabheights's full-sized avatar

Saurabh Khanduja saurabheights

View GitHub Profile
@delta2323
delta2323 / chainer_double_backprop.py
Last active June 5, 2019 11:58
Double back propagation with Chainer (v3.0.0RC1), PyTorch (0.2.0_4), and TensorFlow (1.3.0-dev20170822)
import chainer
from chainer import Variable
import numpy as np
def f(x):
y = x * x * x / 3
gx, = chainer.grad([y], [x], enable_double_backprop=True)
z = gx - 2 * x + 1 # z = (x - 1) ** 2
return z
@0x4C4A
0x4C4A / epsonProjectorOnOff.py
Created August 31, 2017 19:34
Python script to turn an Epson projector on or off via it's network cgi interface
#!/usr/bin/python3
import requests
import re
import time
import sys
projectorAddress = 'http://192.168.1.87'
username = 'EPSONWEB'
password = 'admin'
@kevinzakka
kevinzakka / data_loader.py
Last active March 16, 2025 18:14
Train, Validation and Test Split for torchvision Datasets
"""
Create train, valid, test iterators for CIFAR-10 [1].
Easily extended to MNIST, CIFAR-100 and Imagenet.
[1]: https://discuss.pytorch.org/t/feedback-on-pytorch-for-kaggle-competitions/2252/4
"""
import torch
import numpy as np

⚠️ this is now stupidly out of date

Computers

  • 13" Macbook Pro 3.3 GHz i7 (late 2016)
  • Microsoft Surface Book (2016)

Peripherals

@MMesch
MMesch / robust_splines_sklearn.py
Last active July 6, 2023 23:04
Robust Spline Regression with Scikit-Learn
#!/usr/bin/env python
"""
Robust B-Spline regression with scikit-learn
"""
import matplotlib.pyplot as plt
import numpy as np
import scipy.interpolate as si
from sklearn.base import TransformerMixin
from sklearn.pipeline import make_pipeline
@f0k
f0k / cuda_check.py
Last active December 5, 2024 13:35
Simple python script to obtain CUDA device information
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Outputs some information on CUDA-enabled devices on your computer,
including current memory usage.
It's a port of https://gist.github.com/f0k/0d6431e3faa60bffc788f8b4daa029b1
from C to Python with ctypes, so it can run without compiling anything. Note
that this is a direct translation with no attempt to make the code Pythonic.
@ShigekiKarita
ShigekiKarita / install.sh
Created October 9, 2015 19:11
How to install CUDA7.5 on Ubuntu 14.04
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-get --purge remove "nvidia*"
sudo apt-get --purge remove "cuda*"
wget http://developer.download.nvidia.com/compute/cuda/7.5/Prod/local_installers/cuda-repo-ubuntu1404-7-5-local_7.5-18_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1404-7-5-local_7.5-18_amd64.deb
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install cuda
@erikzenker
erikzenker / CMakeLists.txt
Last active April 15, 2024 17:17
CMake CUDA + C++ in separate files
# CMAKE FILE to separatly compile cuda and c++ files
# with the c++11 standard
#
#
# Folder structure:
#
# |
# +--main.cpp (with C++11 content)
# +--include/
# | |

Last updated: 2017-03-18

Searching for Files

Find images in a directory that don't have a DateTimeOriginal

exiftool -filename -filemodifydate -createdate -r -if '(not $datetimeoriginal) and $filetype eq "JPEG"' .

###Output photos that don't have datetimeoriginal to a CSV### Note this can take a long time if you have a lot of jpgs

@courtneyfaulkner
courtneyfaulkner / devices.c
Created December 11, 2013 22:20
List OpenCL platforms and devices
#include <stdio.h>
#include <stdlib.h>
#ifdef __APPLE__
#include <OpenCL/opencl.h>
#else
#include <CL/cl.h>
#endif
int main() {