Skip to content

Instantly share code, notes, and snippets.

View nemo's full-sized avatar

Nima Gardideh nemo

View GitHub Profile
@nemo
nemo / reddit_thebutton.js
Created April 13, 2015 07:26
Get 1s on The Button in Reddit
// Go to http://www.reddit.com/r/thebutton
// 1. Click on the button once to unlock it.
// 2. Paste the following code into the Javascript Console in Chrome.
function getTheButton() {
var didPress = false;
var currentNumber = parseInt($("#thebutton-s-10s").text() + $("#thebutton-s-1s").text());
if (currentNumber === 1) { // 1 second left! Click!
$(".thebutton-container.active.unlocked").click();
@nemo
nemo / rollbar_error.md
Created April 22, 2015 07:22
Rollbar Crash
break in src/managers/LogManager.js:53
  51 
  52 
  53     debugger;
  54     rollbar.handleError(err, res);
  55     if (res) {
debug> repl
Press Ctrl + C to leave debug repl
> err
@nemo
nemo / gist:4371269
Last active December 10, 2015 02:58
Check which BaseRecipes don't have an image
require 'ruby-progressbar'
base_recipes = BaseRecipe.where(:draft => false)
pbar = ProgressBar.create :total => base_recipes.count
url_but_not_image = []
no_image_and_no_url = []
def image_exists(url)
@nemo
nemo / mem_err.py
Last active November 22, 2016 02:56
Keras memory error issue
from keras.models import Sequential
from keras.layers.core import Flatten, Dense, Dropout, Lambda
from keras.layers.normalization import BatchNormalization
from keras.layers.convolutional import Convolution2D, MaxPooling2D, ZeroPadding2D
from keras.optimizers import SGD, RMSprop, Adam
from theano.sandbox import cuda
from keras.preprocessing import image
cuda.use('gpu')
@nemo
nemo / error.txt
Last active December 7, 2016 23:17
keras_model_rnn_error.py
theano/scan_module/scan_perform.pyx in theano.scan_module.scan_perform.perform (/home/ubuntu/.theano/compiledir_Linux-4.4--generic-x86_64-with-debian-stretch-sid-x86_64-2.7.12-64/scan_perform/mod.cpp:4193)()
ValueError: dimension mismatch in args to gemm (64,256)x(256,256)->(1,256)
Apply node that caused the error: GpuGemm{no_inplace}(GpuSubtensor{::, int64::}.0, TensorConstant{0.20000000298}, <CudaNdarrayType(float32, matrix)>, lstm_7_U_o_copy[cuda], TensorConstant{0.20000000298})
Toposort index: 5
Inputs types: [CudaNdarrayType(float32, matrix), TensorType(float32, scalar), CudaNdarrayType(float32, matrix), CudaNdarrayType(float32, matrix), TensorType(float32, scalar)]
Inputs shapes: [(1, 256), (), (64, 256), (256, 256), ()]
Inputs strides: [(0, 1), (), (256, 1), (256, 1), ()]
Inputs values: ['not shown', array(0.20000000298023224, dtype=float32), 'not shown', 'not shown', array(0.20000000298023224, dtype=float32)]
Outputs clients: [[GpuElemwise{Composite{(clip((i0 + i1), i2, i3) * tanh(i4))},no_inplace}(C
@nemo
nemo / email-service.send.js
Last active March 1, 2017 21:40
Email Service: Send
const lib = require('lib');
lib['./send']({
message: {
to: [{
email: "nima@halfmoon.ws",
name: "Nima Gardideh",
type: "to"
}],
headers: {
@nemo
nemo / email-service.subscribe.js
Created March 1, 2017 21:40
Email Service: Subscribe
const lib = require('lib');
lib['./subscribe']({
email_address: 'email-address@domain.com',
first_name: 'Nima',
last_name: 'Gardideh'
}, (err) => {
// Handle error
});
@nemo
nemo / tc_scrape.js
Last active March 13, 2017 22:21
Techcrunch Article Title Scraper
const lib = require('lib');
const async = require('async');
const _ = require('lodash');
var pages = [
'https://techcrunch.com/',
...(_.range(2, 100).map((i) => "https://techcrunch.com/page/" + i))
];
async.mapLimit(pages, 10, (pageUrl, callback) => {
@nemo
nemo / lib.utils.read.sh
Last active March 15, 2017 01:46
utils.log.read usage
# STDLIB_LIBRARY_TOKEN can be found on your dashboard
lib utils.log.read -t STDLIB_LIBRARY_TOKEN --service service-name
@nemo
nemo / .hyper.js
Created August 10, 2017 21:55
.hyper.js
module.exports = {
config: {
// default font size in pixels for all tabs
fontSize: 12,
// font family with optional fallbacks
fontFamily: 'Hack, Menlo, "DejaVu Sans Mono", Consolas, "Lucida Console", monospace',
// terminal cursor background color and opacity (hex, rgb, hsl, hsv, hwb or cmyk)
cursorColor: 'rgba(248,28,229,0.8)',