Skip to content

Instantly share code, notes, and snippets.

@vik-y
vik-y / interfaces
Created September 6, 2015 05:00
Raspberry pi wifi connection
#
# /etc/network/interfaces
auto lo
iface lo inet loopback
iface eth0 inet dhcp
#allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
@vik-y
vik-y / delete_all_tweets.py
Last active September 22, 2023 21:04 — forked from davej/delete_all_tweets.py
This script will delete all of the tweets in a specified account.
# -*- coding: utf-8 -*-
"""
This script is forked originally from Dave Jeffery. The original implementation
was very slow and deleted around 2 tweets per second. Making it multithreaded I
am able to delete 30-50 tweets per second.
@author: vik-y
----------------------------------------------------------------------------
This script will delete all of the tweets in the specified account.
from socket import *
s=socket(AF_INET, SOCK_DGRAM)
s.bind(('',12345))
m=s.recvfrom(1024)
print m[0]
@vik-y
vik-y / nat.sh
Created July 21, 2015 06:30
A code for forwarding
modprobe iptable_nat
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE #Forward on this interface
iptables -A FORWARD -i wlan0 -j ACCEPT #Tells to accept all connections coming on wlan0
# Works completely fine - Need to test it on OpenVPN
# Here the interface which has internet is eth0
# Need to understand POSTROUTING nad MASQUERADE
@vik-y
vik-y / ApiConnectCode
Created July 11, 2015 12:28
hackathon android code
package APIConnect;
import android.util.Base64;
import android.util.Log;
import android.widget.Toast;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
@vik-y
vik-y / curl.sh
Created June 24, 2015 15:32
Some quick hacks regarding using curl
#http://curl.haxx.se/docs/httpscripting.html#GET Use this link for further reference
curl --referer http://www.example.come http://www.example.com
# To fake the referrer header
curl --location http://www.example.com
# To make curl follow the redirects as well
curl --upload-file uploadfile http://www.example.com/receive.cgi
@vik-y
vik-y / traceroute.py
Created May 31, 2015 19:04
From http://www.secdev.org/projects/scapy/doc/usage.html A lovely way to make traceroute graphs. Love it.
>>> res,unans = traceroute(["www.microsoft.com","www.cisco.com","www.yahoo.com","www.wanadoo.fr","www.pacsec.com"],dport=[80,443],maxttl=20,retry=-2)
Received 190 packets, got 190 answers, remaining 10 packets
193.252.122.103:443 193.252.122.103:80 198.133.219.25:443 198.133.219.25:80 207.46...
1 192.168.8.1 192.168.8.1 192.168.8.1 192.168.8.1 192.16...
2 82.251.4.254 82.251.4.254 82.251.4.254 82.251.4.254 82.251...
3 213.228.4.254 213.228.4.254 213.228.4.254 213.228.4.254 213.22...
[...]
>>> res.graph() # piped to ImageMagick's display program. Image below.
>>> res.graph(type="ps",target="| lp") # piped to postscript printer
>>> res.graph(target="> /tmp/graph.svg") # saved to file
@vik-y
vik-y / composer.json
Created May 30, 2015 15:00
A command line tool to parse json composer.json for testing how it works
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"laravel/framework": "4.2.*"
},
"autoload": {
@vik-y
vik-y / RSA.py
Last active August 29, 2015 14:22 — forked from avalonalex/RSA.py
import random
from itertools import combinations
import math
import copy
def euclid(a, b):
"""returns the Greatest Common Divisor of a and b"""
a = abs(a)
b = abs(b)
@vik-y
vik-y / AlchemyNews.py
Created May 25, 2015 07:22
Alchemy News Api Call using python
'''
A basic implementation of calling Alchemy API using python.
I have used request library but you can use urllib too
'''
import requests
import json
from BeautifulSoup import BeautifulSoup