Skip to content

Instantly share code, notes, and snippets.

@opnchaudhary
opnchaudhary / 503.php
Created May 12, 2014 10:38
503 page for WordPress
<?php
header(“HTTP/1.1 503 Service Temporarily Unavailable”);
header(“status: 503 Service temporarily Unavailable”);
header(“Retry-After: Mon 1 April 2013 00:00 GMT”);
?>
@opnchaudhary
opnchaudhary / install-gnustep.sh
Created April 16, 2014 12:05
Installing GnuStep in Ubuntu
sudo apt-get install gnustep gnustep-devel gobjc
@opnchaudhary
opnchaudhary / bright
Created April 16, 2014 06:36
Bash script to change brightness of Dell Studio 1569 laptop. Permissable values 0 to 4000.
#!/bin/bash
echo $1 | sudo tee /sys/class/backlight/intel_backlight/brightness
@opnchaudhary
opnchaudhary / coutries_with_Iso.php
Last active August 29, 2015 13:59 — forked from vxnick/gist:380904
Array of countries with their iso codes
<?php
$countries = array
(
'AF' => 'Afghanistan',
'AX' => 'Aland Islands',
'AL' => 'Albania',
'DZ' => 'Algeria',
'AS' => 'American Samoa',
'AD' => 'Andorra',
@opnchaudhary
opnchaudhary / phash_install.sh
Last active September 27, 2017 07:06
installing pHash
wget https://github.com/sdepold/pHash/archive/master.zip
unzip master.zip
cd pHash-master
./configure --enable-video-hash=no --enable-audio-hash=no
make
make install
cd bindings/php
./configure --disable-video_hash --disable-audio_hash
@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)
@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 / 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 / install_modsecurity.sh
Created January 19, 2014 14:57
Install mod_security module
yum install mod_security
service httpd restart
@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