Skip to content

Instantly share code, notes, and snippets.

View yoimbert's full-sized avatar

yoimbert yoimbert

View GitHub Profile
@yoimbert
yoimbert / 0_reuse_code.js
Created May 28, 2014 21:21
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
<?php
use Aws\Common\Aws;
use Aws\S3\Exception\S3Exception;
// make sure the SDK is installed
// I've used Composer to autoload it: http://docs.aws.amazon.com/aws-sdk-php/guide/latest/installation.html
/*
* jQuery File Upload Plugin PHP Class 7.1.0
* https://github.com/blueimp/jQuery-File-Upload
<?php
use Aws\Common\Aws;
use Aws\S3\Exception\S3Exception;
// make sure the SDK is installed
// I've used Composer to autoload it: http://docs.aws.amazon.com/aws-sdk-php/guide/latest/installation.html
/*
* jQuery File Upload Plugin PHP Class 7.1.0
* https://github.com/blueimp/jQuery-File-Upload
@yoimbert
yoimbert / PassivePortRange
Created July 16, 2014 17:52
PassivePortRange pure-ftpd
# 1) Configure pure-ftpd
echo "40110 40210" > /etc/pure-ftpd/conf/PassivePortRange
/etc/init.d/pure-ftpd-mysql restart
# 2) Configure the firewall. If you use ISPConfig 3 on my server to configure the bastille firewall, you can add the nescessery port range in the ISPConfig firewall settings.
Change the list of Open TCP ports from:
20,21,22,25,53,80,110,143,443,3306,8080,10000
to:
20,21,22,25,53,80,110,143,443,3306,8080,10000,40110:40210
and then click on "Save".
@yoimbert
yoimbert / AMI Snapshots
Created July 22, 2014 08:08
Clean up your AMI Snapshots
#source : http://kloudrocks.com/
# Unregister and clean AMI snapshots
$amiName = 'ami-XXXX' # replace this with the AMI ID you need to clean-up
$myImage = Get-EC2Image $amiName
$count = $myImage[0].BlockDeviceMapping.Count
# Loop and store snapshotID(s) to an array
$mySnaps = @()
for ($i=0; $i -lt $count; $i++)
@yoimbert
yoimbert / syntax where
Last active August 29, 2015 14:10
syntax LAF
$query_RecordsetLot = "UPDATE Lots SET `status` = 'optionné' , date='".date("Y-m-d", mktime(0, 0, 0, date("m") , date("d")+14, date("Y")))."', userid=".$_SESSION['kt_login_id']." WHERE idLot =".$idLot;
Pour faire une verif et voir l'erreur.
1/ consulter les logs
2/ Rempalcer les variables par des valeurs
Exemple :
$query_RecordsetLot = "UPDATE Lots SET `status` = 'optionné' , date='2014-11-26', userid=1 WHERE idLot = 547";
@yoimbert
yoimbert / UpdateHour
Created May 29, 2015 12:23
update hour debian FR
Mise a jour heure
dpkg-reconfigure tzdata
@yoimbert
yoimbert / server-status
Created May 29, 2015 14:11
server-status Apache 2.4
ExtendedStatus on
<Location /server-status>
SetHandler server-status
Require all denied
Require ip xxx.xxx.xxx.xxx xxx.xxx.xxx.xxx
Require host domaine.ltd
</Location>
@yoimbert
yoimbert / swapEC2
Last active August 29, 2015 14:22
Swap On EC2
You can add a 1 GB swap to your instance with these commands:
sudo dd if=/dev/zero of=/swapfile bs=1M count=1024
sudo mkswap /swapfile
sudo swapon /swapfile
To enable it by default after reboot, add this line to /etc/fstab:
/swapfile swap swap defaults 0 0
@yoimbert
yoimbert / PIP install
Last active August 29, 2015 14:22
PIP install
Install PIP
download file :
wget https://bootstrap.pypa.io/get-pip.py
install pip
python get-pip.py
install AWS
pip install awscli