Skip to content

Instantly share code, notes, and snippets.

@opnchaudhary
opnchaudhary / gmaps_v3_integration.html
Created July 5, 2013 04:32
Integrate Google maps 3 in website
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Maps</title>
<style>
#map_canvas {
width: 500px;
height: 400px;
}
@opnchaudhary
opnchaudhary / webcamstreaming.xml
Created October 29, 2013 10:24
This xml file can be imported to Adobe Flash Media Encoder and can be used for streaming webcam's video along with microphone's audio to specified rtmp publish point
<?xml version="1.0" encoding='UTF-8'?>
<flashmedialiveencoder_profile>
<preset>
<name>uFame Live</name>
<description>For Webcam Streaming</description>
</preset>
<capture>
<video>
<device>USB Video Device</device>
<crossbar_input>0</crossbar_input>
@opnchaudhary
opnchaudhary / bruteforce.py
Created December 3, 2013 04:29
Used only for https://www.facebook.com/download/1485276195031896/hackme Challenge: Hackers! Are you ready to face a challenge? This is a program compiled for linux. Which -> accepts an integer from command line argument . -> compares that argv with a pre-stored 4-digit integer. -> prints a msg and returns 0 if they match -> returns 1 if they don…
#!/usr/bin/python
import os
var=0
while var<10000:
var+=1
temp='{0:04}'.format(var)
result=os.system('./hackme '+temp)
if result==0:
print "Found : "+temp
break
@opnchaudhary
opnchaudhary / mod_evavsive.conf
Last active January 3, 2016 16:29
Installing mod_evasive in fedora/centos to prevent DOS attacks yum install httpd-devel wget wget http://www.zdziarski.com/blog/wp-content/uploads/2010/02/mod_evasive_1.10.1.tar.gz tar -xzf mod_evasive_1.10.1.tar.gz cd mod_evasive apxs -cia mod_evasive20.c
#/etc/httpd/conf.d/mod_evavsive.conf
LoadModule evasive20_module /usr/lib64/httpd/modules/mod_evasive20.so
<IfModule mod_evasive20.c>
DOSHashTableSize 3097
DOSPageCount 3
DOSSiteCount 100
DOSPageInterval 3
DOSSiteInterval 5
DOSBlockingPeriod 300
@opnchaudhary
opnchaudhary / disable_mysql_history.sh
Created January 18, 2014 11:57
Disable mysql history
rm $HOME/.mysql_history
ln -s /dev/null $HOME/.mysql_history
@opnchaudhary
opnchaudhary / sshd_config
Created January 18, 2014 12:02
Configure ssh for some users to use key file and some users to use password
#/etc/ssh/sshd_config
#ec2-user and root uses key file for login
Match User ec2-user,root
PasswordAuthentication no
#testuser uses password for login
Match User testuser
PasswordAuthentication yes
@opnchaudhary
opnchaudhary / install_modsecurity.sh
Created January 19, 2014 14:57
Install mod_security module
yum install mod_security
service httpd restart
@opnchaudhary
opnchaudhary / https_redirection.conf
Created January 21, 2014 12:05
Apache configuration to force all HTTP to HTTPS request
#File: /etc/httpd/conf.d/https_redirection.conf
#Force all HTTP request to HTTPS request
<IfModule !mod_rewrite.c>
LoadModule rewrite_module /usr/lib/apache2-prefork/mod_rewrite.so
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine on
ReWriteCond %{SERVER_PORT} !^443$
@opnchaudhary
opnchaudhary / ftp_uploader.py
Created March 15, 2014 03:11
A sample example for uploading files using ftp in python
#!/usr/bin/python
import ftplib
session = ftplib.FTP('example.com','username','password')
file = open('cup.mp4','rb') # file to send
session.storbinary('STOR '+'cup.mp4', file) # send the file
file.close() # close file and FTP
session.quit()
@opnchaudhary
opnchaudhary / conky.conf
Created March 30, 2014 16:11
My conky configuration /etc/conky/conky.conf
# Conky, a system monitor, based on torsmo
#
# Any original torsmo code is licensed under the BSD license
#
# All code written since the fork of torsmo is licensed under the GPL
#
# Please see COPYING for details
#
# Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
# Copyright (c) 2005-2010 Brenden Matthews, Philip Kovacs, et. al. (see AUTHORS)