Skip to content

Instantly share code, notes, and snippets.

View dhilipsiva's full-sized avatar
🏠
Working from home

dhilipsiva dhilipsiva

🏠
Working from home
View GitHub Profile
@dhilipsiva
dhilipsiva / unicoins-auto-miner.js
Last active August 29, 2015 13:57
StackOverflow Unicoins Auto Miner
/*
github.com/dhilipsiva
A Simple JavaScript file to AUTO-MINE StackOverflow unicoins:
INSTRCTIONS:
0. goto stackoverflow.com
1. Open your console.
2. Copy this code.
3. Paste this into cosole
@dhilipsiva
dhilipsiva / smoothScrollTo.coffee
Last active August 29, 2015 14:04
A smooth scroll to script
window.smoothScrollTo = (target_id, duration=1000) ->
step = ->
factor = (Date.now() - start) / duration # get interpolation factor
if factor >= 1
clearInterval timer # stop animation
factor = 1 # clip to max 1.0
y = factor * delta + offset
window.scrollBy 0, y - window.pageYOffset
target = document.getElementById(target_id).offsetTop
offset = window.pageYOffset
from itertools import product
nums = [1, 3, 5, 7, 9, 11, 13, 15]
expected_num = 30
nums_to_add = 5
for combination in product(nums, repeat=nums_to_add):
print combination, " = ", sum(combination)
@dhilipsiva
dhilipsiva / GoogleCloudStorageUtil.py
Created December 9, 2014 08:54
A Google Cloud Storage utility - To upload a file, get a file and get a signed URL to post from browser.
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2014 dhilipsiva <dhilipsiva@gmail.com>
#
# Distributed under terms of the MIT license.
"""
Requirements:
1. 2541865828329
2. 3541568428327
3. 2341999999914

Keybase proof

I hereby claim:

  • I am dhilipsiva on github.
  • I am dhilipsiva (https://keybase.io/dhilipsiva) on keybase.
  • I have a public key whose fingerprint is C089 E27F 91EB D68B 75F2 4144 2581 43B7 AA6E 4C40

To claim this, I am signing this object:

@dhilipsiva
dhilipsiva / findPath.coffee
Last active August 29, 2015 14:27
Find path of a value in an object
findPath = (obj, query) ->
for k, v of obj
if typeof v is "object"
path = findPath v, query
return "#{k}.#{path}" if path
else if v is query
return k
@dhilipsiva
dhilipsiva / BadooSpam.coffee
Created August 29, 2015 19:39
Badoo Spam script
###
Badoo spam and like users.
Restrictions due to messages limit per day and captchas still cannot be bypassed. :P
###
getPage = (url) ->
$.get url
.done (response, success, xhr) ->
results = $ response
for result in results.find ".user-card"
d1 = $ result
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Update 7 Oct 2010:
# - This example does *not* appear to work with Chrome >=6.0. Apparently,
# the WebSocket protocol implementation in the cramp gem does not work
# well with Chrome's (newer) WebSocket implementation.
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby
@dhilipsiva
dhilipsiva / UIInterfaceOrientationMask.h
Created July 25, 2012 12:49
iOS 6 UI interface Orientation - shouldAutorotateToInterfaceOrientation: Not working
typedef enum {
UIInterfaceOrientationMaskPortrait = (1 << UIInterfaceOrientationPortrait),
UIInterfaceOrientationMaskLandscapeLeft = (1 << UIInterfaceOrientationLandscapeLeft),
UIInterfaceOrientationMaskLandscapeRight = (1 << UIInterfaceOrientationLandscapeRight),
UIInterfaceOrientationMaskPortraitUpsideDown = (1 << UIInterfaceOrientationPortraitUpsideDown),
UIInterfaceOrientationMaskLandscape =
(UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight),
UIInterfaceOrientationMaskAll =
(UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft |
UIInterfaceOrientationMaskLandscapeRight | UIInterfaceOrientationMaskPortraitUpsideDown),