Skip to content

Instantly share code, notes, and snippets.

View techmaniack's full-sized avatar

Karim Memon techmaniack

View GitHub Profile
@techmaniack
techmaniack / bot.go
Last active June 1, 2017 11:56
Simple twitter bot written in Golang
package main
import (
"fmt"
"github.com/dghubble/go-twitter/twitter"
"github.com/dghubble/oauth1"
)
func main() {
consumerKey := "KEY"
@techmaniack
techmaniack / login_test.go
Last active June 1, 2017 11:48
go-twitter code examples
package main
import (
"fmt"
"github.com/dghubble/go-twitter/twitter"
"github.com/dghubble/oauth1"
)
func main() {
consumerKey := "KEY"
@techmaniack
techmaniack / client.py
Created November 17, 2013 16:53
python tcp ip example (addition of 2 numbers) Example taken from http://docs.python.org/2/library/socket.html
#! /usr/bin/python
# Echo client program
import socket
def parse_file(fName):
list = []
with open(fName) as f:
for line in f:
list.append(line.strip())
return list
@techmaniack
techmaniack / aliases.sh
Created May 3, 2013 11:36
shell_aliases
#Capture screenshot via adb on Samsung Galaxy Devices. (Tested on Galaxy mini 2.3.4 NO ROOT)
#Stores the screenshot on the device (/mnt/sdcard/Screencapture)
alias droidshot='adb shell am startservice -a com.sec.android.app.screencapture -n com.sec.android.app.screencapture/.ScreenCaptureService'
@techmaniack
techmaniack / origami_grabber.rb
Last active June 1, 2017 11:45
Grab all tutorials files from dev.origami.org
#! /usr/bin/env ruby
require 'mechanize'
agent = Mechanize.new
url = "http://dev.origami.org/diagram.cfm?CurrentPage="
base = "http://dev.origami.org/"
21.times do |count|
puts url+"#{count}"
page = agent.get(url+"#{count+1}")
page.links.each do |l|
@techmaniack
techmaniack / prag_mag_grabber.rb
Created November 24, 2012 07:34
a small ruby script to grab The Pragmatic Programmers Free Magazines (http://pragprog.com/magazines)
#! /usr/bin/env ruby
require 'open-uri'
#wget could have been used but then it would
# 1) Make it dependent on an external program
# 2) Make it a one-liner ;)
#
#This script when executed will start downloading all the prag-mags
#in the current directory.
if ARGV.count == 0
@techmaniack
techmaniack / fbtweet.rb
Created September 23, 2012 17:31
Selective tweets post
pushed_tweets=[]
while true
Twitter.user_timeline("techmaniack").each do |item|
if !pushed_tweets.include?item.id
me.feed!(:message => item.text) if item.text.include?"#fb"
puts "POSTING TWEET"
puts item.text
pushed_tweets << item.id
else
puts "NOT POSTING"
@techmaniack
techmaniack / smart_push.rb
Created August 12, 2012 23:19
Smart `adb push`
#!/usr/bin/env ruby
# Ever tried to use wildcard (*) while pushing multiple files to your droid via adb?
# This small little script helps you do it. Of Course there are many ways to do it
# but one is for the ruby-istas :)
# SAMPLE USAGE: ruby smart_push.rb *.pdf books # push all pdf's to /mnt/sdcard/books
ARGV.length > 1 ? (dest = "/mnt/sdcard/#{ARGV[-1]}"; ARGV.pop) : dest = "/mnt/sdcard/"
ARGV.each do |item|
puts File.basename("#{item}") + " is being pushed"
@techmaniack
techmaniack / find-s.rb
Created August 6, 2012 00:09
An implementation of 'Find-S' Algorithm in Ruby
#!/usr/bin/env ruby
# find-s.rb
#
# Copyright 2012 AbdulKarim Memon <abdulkarim@reversehack.in>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
@techmaniack
techmaniack / isbn_decoder.rb
Created July 29, 2012 16:09
ISBN decoder
#!/usr/bin/env ruby
#-------------------------------------------------------------------------------
# Name: isbn_decoder.rb
# Purpose: Fetch title from ISBN .
#
# Author: AbdulKarim Memon
#
# Created: 29/07/2012
# Copyright: (c) AbdulKarim Memon 2012