Skip to content

Instantly share code, notes, and snippets.

View oussemos's full-sized avatar

Oussema Ch oussemos

  • Paris, France
View GitHub Profile
@oussemos
oussemos / iptables-country-block
Created September 19, 2013 08:51
This tool will automatically create iptables rules on Linux system to block all connection from one country or more. The blocklist is created with an API that fetch data in our SQL database based on IP address country location.
#!/bin/bash
### IpInfoDB iptables countries block bash script###
### Slightly modified script from http://www.cyberciti.biz
### Countries code available : http://ipinfodb.com/country.txt ###
### Block all traffic from AFGHANISTAN (af) and CHINA (CN). Use ISO code ##
ISO="AF CN"
### Set PATH ###
IPT=/sbin/iptables
WGET=/usr/bin/wget
@oussemos
oussemos / Flush-iptables.sh
Created October 8, 2013 13:33
Rest Iptables Rules
#!/bin/sh
echo "Flushing iptables rules..."
sleep 1
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
iptables -P INPUT ACCEPT
/usr/lib/postgresql/9.1/bin/pg_upgrade -d /var/lib/postgresql/8.3/main -D /var/lib/postgresql/9.1/main -b /usr/lib/postgresql/8.3/bin -B /usr/lib/postgresql/9.1/bin -k -v
Running in verbose mode
Performing Consistency Checks
-----------------------------
Checking current, bin, and data directories
You must have read and write access in the current directory.
Failure, exiting
postgres@vds2192:/root$ cd /var/lib/postgresql/
postgres@vds2192:~$ /usr/lib/postgresql/9.1/bin/pg_upgrade -d /var/lib/postgresql/8.3/main -D /var/lib/postgresql/9.1/main -b /usr/lib/postgresql/8.3/bin -B /usr/lib/postgresql/9.1/bin -k -v
Running in verbose mode
https://developers.google.com/appengine/articles/appengine_helper_for_django?hl=fr&csw=1
http://code.google.com/p/vosao/
#!/bin/sh
echo "Stopping firewall and allowing everyone..."
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
class Hello
def hello
'hello'
end
def call_hello
hello()
end
end
class Hello(object):
def hello(self):
return 'hello'
def call_hello(self):
return self.hello()
# Kernel sysctl configuration file for Linux
#
# Version 1.9 - 2011-03-23
# Michiel Klaver - IT Professional
# http://klaver.it/linux/ for the latest version - http://klaver.it/bsd/ for a BSD variant
#
# This file should be saved as /etc/sysctl.conf and can be activated using the command:
# sysctl -e -p /etc/sysctl.conf
#
# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and sysctl.conf(5) for more details.
@oussemos
oussemos / fix_imap_time_for_apple_mail.sh
Created October 8, 2014 08:37
fix imap time for apple mail
#!/bin/sh
#
# Date : July 4th, 2005
# Author: Benson Wong
# tummytech@gmail.com
#
# This shell script corrects email messages where the file system
# date does not match the Date: header in the email.
#
# This will fix problems with mail clients like Apple's mail.app
398 update-ca-trust force-enable
401 update-ca-trust extract
403 openssl s_client -showcerts -connect github.com:443 </dev/null 2>/dev/null|openssl x509 -outform PEM >mycertfile.pem
405 cp mycertfile.pem /etc/pki/ca-trust/source/anchors/
406 update-ca-trust extract