Skip to content

Instantly share code, notes, and snippets.

View vik-y's full-sized avatar

Vikas Yadav vik-y

View GitHub Profile
@vik-y
vik-y / youtube.sh
Last active August 29, 2015 14:17
Capture ip of people who are browsing youtube
sudo tcpdump -i wlan0 -n src 216.58.220.46 -c 5 > capture.dat #can also use src youtube.com
cat capture.dat
cat capture.dat | awk -F ' ' '{print $5}' | awk -F '.' '{print $1"."$2"."$3"."$4}' | awk -F ':' '{print $1}'
@vik-y
vik-y / decipher.py
Created March 28, 2015 19:12
Hack this site Programming Challenge 1
f = open('wordlist.txt', 'r')
a = f.readlines()
for i in range(0, len(a)):
a[i] = a[i][:-2]
b = []
for val in a:
@vik-y
vik-y / youtube.py
Last active August 29, 2015 14:17
To download a list of files from youtube
'''
Copy the list from youtube and save it in a file urls.txt
Run this script to get all the urls
Put them in a file and run youtube-dl --playlist-start <number> --playlist-end <number> -a "filename.txt"
Download entire playlist
'''
from BeautifulSoup import BeautifulSoup
a = open('urls.txt', 'r')
@vik-y
vik-y / gist:f78a90216a1e2394a0a3
Created April 3, 2015 02:02
fix for autoadjusting page in phonegap app
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, target-densitydpi=medium-dpi, user-scalable=0" />
@vik-y
vik-y / android.java
Last active August 29, 2015 14:18
Android Working Http request Using threads
/*
* App crashes if you don't make a separate thread to send your http requests.
* This example uses a new thread to send http requests and hence won't crash the application.
*/
Random generator = new Random();
int i = generator.nextInt(6) + 1;
List<NameValuePair> pairs = new ArrayList<NameValuePair>();
@vik-y
vik-y / ping.sh
Last active August 29, 2015 14:18
Shell Script to test internet connection at IIIT-B
#!/bin/bash
echo "" > result.txt
date >> result.txt
echo "Zense"
function test (){
date
echo " "
@vik-y
vik-y / images.py
Created April 12, 2015 18:37
Download all images on a webpage
import requests
from BeautifulSoup import BeautifulSoup
r = requests.get('http://<url>')
while r.status_code!=200:
r = requests.get('http://<urL>')
soup = BeautifulSoup(r.text)
@vik-y
vik-y / java_endsem.java
Created May 8, 2015 07:16
Java Exam minor things
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Scanner;
import java.io.*;
import javax.naming.ldap.SortControl;
@vik-y
vik-y / shell.py
Last active August 29, 2015 14:21
Run shell command and capture output using python
def run_terminal(command):
p = subprocess.Popen(command.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = p.communicate()
return out
@vik-y
vik-y / koding.txt
Created May 15, 2015 21:01
Transfer file using ssh from Koding VM
After you are done configuring SSH:
To log in:
First you have to make sure that your ssh-agent uses your public key. For that run
eval "$(ssh-agent -s)" in the terminal from which you want to SSH
After doing that
To get ssh access:
ssh username@kodingurl