Skip to content

Instantly share code, notes, and snippets.

View benoitjpnet's full-sized avatar
🇯🇵
Working from home

Benoit benoitjpnet

🇯🇵
Working from home
View GitHub Profile
@benoitjpnet
benoitjpnet / awstatizer.sh
Created August 29, 2012 09:53
Awstatizer Generate awstats data and adapt config
#!/bin/bash
cd /etc/apache2/sites-available/
for vhostname in *;
do
if [ -f /etc/awstats/awstats.${vhostname}.conf ]; then
echo "Traiter le vhost $vhostname ? [Y/n]"
read
if [ "$REPLY" = "n" ]; then
continue;
fi
@benoitjpnet
benoitjpnet / deactivate_mutiple_vacations.sh
Created September 3, 2012 14:22
deactivate vacation for multiples account
#!/bin/bash
date=$(date +%Y%m%d)
for homedir in toto tata titi;
do
if [ -d /home/${homedir} ] ; then
echo "Deactivating $homedir vacation";
cd /home/${homedir}
mv .forward .forward.${date}
mv .vacation.db .vacation.db.${date}
mv .vacation.msg .vacation.msg.${date}
@benoitjpnet
benoitjpnet / commands
Created October 1, 2012 13:34
Useful commands
# Find files newert than (mtime) a precise date, and execute an action.
find . ! -newermt '2012-09-19 11:40:00' -exec cp {} /tmp/mails \;
@benoitjpnet
benoitjpnet / migrateaacount.sh
Last active October 12, 2015 01:38
Get useradd command for migrating account
for i in user1 user2 user3...; do echo -n 'useradd -m -s /bin/bash -u '$(grep -E "^$i" /etc/passwd | cut -d':' -f3) && echo -en ' -p' \'$(grep -E "^$i" /etc/shadow | cut -d ':' -f2)\' $i '\n'; done
Output :
useradd -m -s /bin/bash -u USERID -p 'USERPWD' username
@benoitjpnet
benoitjpnet / itk_change.sh
Last active October 13, 2015 02:28
itk change rights
find /tmp/ -user www-user.old -exec chown www-user:user {} \;
find /tmp/ -user user.old -exec chown user:user {} \;
* Détecter les fichiers non lisibles par Apache (lecture sur le groupe) : find ./ -type f ! -perm /g=r -exec ls -l {} \;
* Détecter les répertoires non lisibles par Apache (lecture/exécution sur le groupe) : find ./ -type d \( ! -perm /g=r -o ! -perm /g=x \) -exec ls -ld {} \;
* Détecter les fichiers/répertoires accessibles en écriture par Apache (écriture sur le groupe) : find ./ -perm /g=w
* Détecter les fichiers/répertoires accessibles en écriture par tous : find ./ -perm -007 -o -type f -perm -006
@benoitjpnet
benoitjpnet / .tmux.conf
Last active October 13, 2015 06:57
Tmux Configuration
# Use vi style when copy-paste mode.
set-window-option -g mode-keys vi
# Use ZSH by default
set-option -g default-shell /bin/zsh
# Map alt keys + direction keys for switching pane.
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
# Active monitoring
#!/bin/bash
#Script de connection automatique au réseau wifi et au portail captif de l'université
#de Nancy-Metz
#Start 28/09/10
#Last edit : 5/10/10
#Last Comment : Ajout de la libnotify pour envoyer de msg.
#Révision : stable
#Version : 1.2
#Var
@benoitjpnet
benoitjpnet / scriptus.sh
Created February 2, 2013 15:33
Scriptus was an old script to automatically add into a webiste Japanese OSTs uploaded/released by Nipponsei group.
#!/bin/bash
####################
#SCRIPTUS #
#Version 2.0a #
#By Benpro #
#[email protected]#
#www.benprobox.fr #
#Date : 27/07/09 #
####################
@benoitjpnet
benoitjpnet / scriptusold.sh
Created February 2, 2013 15:36
Scriptus was an old script to automatically add into a webiste Japanese OSTs uploaded/released by Nipponsei group.
#!/bin/sh
#Upload auto for animesost
#benrpo - 27-08-08
#Variables
ftp_user=""
ftp_password=""
ftp_host="animesost.info"
http_user=""
http_pass=""
@benoitjpnet
benoitjpnet / contact_mails
Last active December 14, 2015 07:09
List of contacts when sending a mail for technical purpose on a domain which doesn't announce their technical contacts in a whois.
abuse@<domain>, admin@<domain>, administrator@<domain>, contact@<domain>, info@<domain>, postmaster@<domain>, support@<domain>, webmaster@<domain>