This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * It took me a whole 6 hours to finally get the color conversion right. | |
| * I have a fairly good understanding of the various color formats (YUV420P, SP, 422, etc etc), | |
| * and how to access individual Y, U, and V components. | |
| * I however struggled because of a very simple yet hair-pulling gotcha. | |
| * All primitives in Java are signed! If you come from a Python-like world where 0xFF prints 255, | |
| * you see yourself struggle just the same. I am however embarrassed at spending 6 hours on this. | |
| * | |
| * @author rish | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Simple vertex shader | |
| private static final String VERTEX_SHADER = | |
| "uniform mat4 uMVPMatrix;\n" + | |
| "uniform mat4 uTexMatrix;\n" + | |
| "attribute vec4 aPosition;\n" + | |
| "attribute vec4 aTextureCoord;\n" + | |
| "varying vec2 vTextureCoord;\n" + | |
| "void main() {\n" + | |
| " gl_Position = uMVPMatrix * aPosition;\n" + | |
| " vTextureCoord = (uTexMatrix * aTextureCoord).xy;\n" + |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| ''' | |
| uses PIL to resize all images in a directory | |
| ''' | |
| import Image | |
| import os, sys | |
| def resizeImage(infile, output_dir="", size=(640,480)): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /usr/bin/env python | |
| ''' | |
| Created on June 3, 2018 | |
| @author: rish | |
| This snippet sends messages or video calls a friend on Whatsapp. | |
| This requires you to keep the Whatsapp chat page open for this to work. | |
| ''' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # If you come from bash you might have to change your $PATH. | |
| # export PATH=$HOME/bin:/usr/local/bin:$PATH | |
| # Path to your oh-my-zsh installation. | |
| export ZSH="/home/rish/.oh-my-zsh" | |
| # Set name of the theme to load. Optionally, if you set this to "random" | |
| # it'll load a random theme each time that oh-my-zsh is loaded. | |
| # See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes | |
| ZSH_THEME="robbyrussell" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [ | |
| { "keys": ["f12"], "command": "htmlprettify"}, | |
| { "keys": ["f1"], "command": "fold" }, | |
| { "keys": ["f2"], "command": "unfold" }, | |
| { "keys": ["ctrl+l"], "command": "show_overlay", "args": {"overlay": "goto", "text": "@"} }, | |
| { "keys": ["ctrl+space"], "command": "auto_complete" }, | |
| { "keys": ["ctrl+space"], "command": "replace_completion_with_auto_complete", "context": | |
| [ | |
| { "key": "last_command", "operator": "equal", "operand": "insert_best_completion" }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Note: I still need to work on the fastai api more to code this without a tabularlist. | |
| - | |
| I've been doing the fastai course and all the examples put up there are on complicated data - images, text, tables. | |
| I wanted to take a seemingly simple problem of finding the maximum in a list. | |
| I've only been able to get a 94% accuracy with whatever I've learnt so far. I thought it'd be an accurate 100%, | |
| but maybe I'm just not deep enough into the course yet. | |
| Note, I originally didn't want to classify, but make it a regression problem, but I wasn't able to use the fastai api | |
| to do so. There's this `FloatList` option, but i can't seem to get it to work. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ''' | |
| Keras's ImageDataGenerator is buggy. It first resizes based on `target_size`, | |
| and then applies the preprocessing function you specified. This sucks. | |
| Who wants that to happen anyway. | |
| ''' | |
| def crop_image(img): | |
| print(img.shape) | |
| return img |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| United States | Alabama | 32.6010112 | -86.6807365 | |
|---|---|---|---|---|
| United States | Alaska | 61.3025006 | -158.7750198 | |
| United States | Arizona | 34.1682185 | -111.930907 | |
| United States | Arkansas | 34.7519275 | -92.1313784 | |
| United States | California | 37.2718745 | -119.2704153 | |
| United States | Colorado | 38.9979339 | -105.550567 | |
| United States | Connecticut | 41.5187835 | -72.757507 | |
| United States | Delaware | 39.145251 | -75.4189206 | |
| United States | District of Columbia | 38.8993487 | -77.0145666 | |
| United States | Florida | 27.9757279 | -83.8330166 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Converts Deutsche Bank's CSV of transactions to various categories to see what you're spending money on. | |
| This isn't the neatest code I've written. But it gets what I need done. | |
| I want to see how much I spend on various categories every month. That's it. | |
| Output looks like: | |
| 2020-03-01 00:00:00 to 2020-03-31 00:00:00 | |
| essentials: -1275.2 |