Skip to content

Instantly share code, notes, and snippets.

View whatnick's full-sized avatar

Tisham Dhar whatnick

View GitHub Profile
package org.whatnick.btc;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
public class btc_validate {
private final static String template = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
@whatnick
whatnick / Cudaj2k MSVC 2010
Created September 11, 2013 03:37
CUDA Jpeg2000 Windows port
Index: gpu_jpeg2k/CMake/FindFreeImage.cmake
===================================================================
--- gpu_jpeg2k/CMake/FindFreeImage.cmake (revision 84)
+++ gpu_jpeg2k/CMake/FindFreeImage.cmake (working copy)
@@ -14,7 +14,7 @@
FIND_LIBRARY( FREEIMAGE_LIBRARY
NAMES FreeImage freeimage
PATHS
- ${PROJECT_SOURCE_DIR}/FreeImage
+ ${PROJECT_SOURCE_DIR}/extern/FreeImage
@whatnick
whatnick / pycuda_ray_cast.py
Created October 10, 2013 07:56
Orthogonal projection of some primitives (Sphere, Torus) using Pycuda based ray casting. Ported from - http://code.finkjensen.be/2011/11/ray-marching-on-implicit-surfaces-with-cuda-cc-and-visual-c/
'''
Created on 09/10/2013
PyCUDA api usage for ray-casting
@author: Tisham
'''
import pycuda.driver as drv
import pycuda.tools
@whatnick
whatnick / RealPowerMeter_NoWifi
Last active March 17, 2016 14:13
Real Power meter with OLED display, no wifi
/*
* This sketch sends ads1115 current sensor data via HTTP POST request to thingspeak server.
* It needs the following libraries to work (besides the esp8266 standard libraries supplied with the IDE):
*
* - https://github.com/adafruit/Adafruit_ADS1X15
* - https://github.com/adafruit/Adafruit-GFX-Library
* - https://github.com/adafruit/Adafruit_SSD1306
*
* designed to run directly on esp8266-12 module, to where it can be uploaded using this marvelous piece of software:
*
@whatnick
whatnick / Blink_7seg.ino
Last active April 19, 2016 07:56
Random number display on 7-segment LED
'''
Created on Apr 24, 2016
@author: tisham
'''
import time
import requests
import cv2
import operator
import numpy as np
@whatnick
whatnick / test_mpl3115.py
Last active July 21, 2016 07:55
Test MPL3115 barometer/altimeter using Python
temp_raw_file = open('/sys/class/i2c-dev/i2c-1/device/1-0060/iio:device0/in_temp_raw','r')
temp_scale_file = open('/sys/class/i2c-dev/i2c-1/device/1-0060/iio:device0/in_temp_scale','r')
print "temperature: %.2f" %(int(temp_raw_file.read())*float(temp_scale_file.read()))
pres_raw_file = open('/sys/class/i2c-dev/i2c-1/device/1-0060/iio:device0/in_pressure_raw','r')
pres_scale_file = open('/sys/class/i2c-dev/i2c-1/device/1-0060/iio:device0/in_pressure_scale','r')
print "pressure: %.4f" %(int(pres_raw_file.read())*float(pres_scale_file.read()))
@whatnick
whatnick / test_LM75.py
Created July 10, 2016 14:22
Test LM75 temperature sensor
import time
from tentacle_pi.LM75 import LM75
lm = LM75(0x48,"/dev/i2c-1")
temperature = lm.temperature()
print "temperature: %0.2f" % temperature
time.sleep(2)
import time
from tentacle_pi.LM75 import LM75
import httplib, urllib
from time import localtime, strftime
lm = LM75(0x48,"/dev/i2c-1")
while(True):
temperature = lm.temperature()
print "temperature: %0.2f" % temperature
import machine
import time
SysStatus = 0x01 #System Status
sck = machine.Pin(5,machine.Pin.OUT)
mosi = machine.Pin(18,machine.Pin.OUT)
miso = machine.Pin(19,machine.Pin.IN)
cs1 = machine.Pin(15,machine.Pin.OUT)
cs2 = machine.Pin(33,machine.Pin.OUT)