spirit  [ Profile ]

Sort by: Date / Title /

  1. 1 month ago
    Prevents jobs to collide if they take longer to run than the frequency itself
    1. $fp = fopen('/tmp/lock.txt', 'r+')
    2.  
    3. if(!flock($fp, LOCK_EX | LOCK_NB)) { 
    4.    echo 'Unable to obtain lock'
    5.    exit(-1)
    6. } 
    7.    
    8. /* ... */ 
    9.  
    10. fclose($fp);
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2040"></script>
  2. 1 month ago
    it's also possibl with a .htaccess file and "deny from all " in that file
    1. if (isset($_SERVER['REMOTE_ADDR'])) die('Permission denied.');
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2039"></script>
  3. 1 month ago
    1. #someElement { 
    2.   background: red; /* modern browsers */ 
    3.   *background: green; /* IE 7 and below */ 
    4.   _background: yellow; /* IE6 exclusively */ 
    5. }
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2037"></script>
  4. sponsorised links
  5. 2 months ago
    1. # Nginx status
    2. server {
    3.   listen 80;
    4.   server_name localhost;
    5.   location /nginx_status {
    6.     stub_status on;
    7.     access_log off;
    8.     allow 127.0.0.1;
    9.     deny all;
    10.   }   
    11. }
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2023"></script>
  6. 2 months ago
    if ($request_uri ~* "\.(ico|css|js|gif|jpe?g|png)\?[0-9]+$") {
      access_log off;
      expires 31d;
      break;
    }
    # Matching URLs
    http://domain.com/stylesheets/blog.css?1221178271
    
    if ($request_uri ~* "\.(ico|gif|png|jpe?g|css|js|swf)(\?v\d\d?)?$") {
      access_log off;
      expires 31d;
      break;
    }
    # Matching URLs
    http://domain.com/stylesheets/blog.css
    http://domain.com/stylesheets/blog.css?v1
    http://domain.com/stylesheets/blog.css?v12
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2021"></script>
  7. 2 months ago
    1. ## Only allow these request methods
    2. if ($request_method !~ ^(GET|HEAD|POST)$ ) {
    3.     return 444;
    4. }
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2019"></script>
  8. 2 months ago
    1. location = /favicon.ico {
    2.     access_log off;
    3.     return 204;
    4.     # or empty_gif;
    5. }
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2018"></script>
  9. 2 months ago
    server {
        server_name mysite.tld ~^.+.mysite.tld$;
    
        map $host $files {
            default            common;
            mysite.tld         common;
            www.mysite.tld     common;
            admin.mysite.tld   admin;
            system.mysite.tld  system;
            *.mysite.tld       users;
        }
        root /var/www/mysite/$files;
    }
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2017"></script>
  10. 2 months ago
    1. server {
    2.     listen 80;
    3.     listen 443 default ssl;
    4.  
    5.     # other directives
    6. }
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2016"></script>
  11. 2 months ago and saved by 1 other
    automatically create a SVN repository from a web project directory including trunk, branches and tags
    1. #!/bin/bash
    2.  
    3. # Vous pouvez éditer ces variables selon vos besoins
    4. SVN_ROOT="/srv/unit1/svn"
    5. SVN_TMP_PATH="/tmp/svn"
    6. $SVN_USER="svn"
    7. $SVN_GROUP="svn"
    8.  
    9. # Ce script doit être executé avec les droits de superutilisateur
    10. test -w /root;
    11. if [ ! "$?" -eq "0" ]; then
    12.         echo "Vous devez executer ce script en tant que superutilisateur."
    13.         exit 0
    14. fi
    15.  
    16. echo "#######################################"
    17. echo "Création d'un nouveau projet Subversion"
    18. echo "#######################################"
    19. echo ""
    20. echo "Tapez le nom du nouveau projet :"
    21. read PROJECT_NAME
    22.  
    23. if [ -z "$PROJECT_NAME" ]; then
    24.         echo "$PROJECT_NAME n'est pas un nom de projet valide.";
    25.         exit 0 
    26. fi
    27.  
    28. echo "Tapez maintenant le chemin du répertoire source :"
    29. echo "(Note: les répertoires trunk, branches et tags seront créés automatiquement)"
    30. read PROJECT_SOURCE_PATH
    31.  
    32. if [ -z "$PROJECT_SOURCE_PATH" -o ! -d $PROJECT_SOURCE_PATH ]; then
    33.         echo "$PROJECT_SOURCE_PATH n'est pas un répertoire valide.";
    34.         exit 0
    35. fi
    36.  
    37. echo "Création du projet $PROJECT_NAME depuis $PROJECT_SOURCE_PATH..."
    38.  
    39. # Si le répertoire $SVN_ROOT n'existe pas, on le crée
    40. if [ ! -d $SVN_ROOT ]; then
    41.         mkdir $SVN_ROOT
    42. fi
    43.  
    44. # Si le répertoire $SVN_TMP_PATH n'existe pas, on le crée
    45. if [ ! -d $SVN_TMP_PATH ]; then
    46.         mkdir $SVN_TMP_PATH
    47. fi     
    48.  
    49. # Création du répertoire du dépôt
    50. mkdir $SVN_ROOT/$PROJECT_NAME
    51.  
    52. # Création d'un répertoire temporaire de stockage avant import
    53. mkdir $SVN_TMP_PATH/$PROJECT_NAME
    54. mkdir $SVN_TMP_PATH/$PROJECT_NAME/branches
    55. mkdir $SVN_TMP_PATH/$PROJECT_NAME/tags
    56. mkdir $SVN_TMP_PATH/$PROJECT_NAME/trunk
    57.  
    58. # Copie des fichiers originaux dans le répertoire temporaire
    59. cp -R $PROJECT_SOURCE_PATH/* $SVN_TMP_PATH/$PROJECT_NAME/trunk/
    60.  
    61. # Création du dépôt et import depuis le répertoire créé
    62. svnadmin create $SVN_ROOT/$PROJECT_NAME
    63. svn import $SVN_TMP_PATH/$PROJECT_NAME file://$SVN_ROOT/$PROJECT_NAME -m "Initial import"
    64.  
    65. # Attribution des permissions à Apache sur le repertoire du dépot
    66. chown -R $SVN_USER:$SVN_GROUP $SVN_ROOT/$PROJECT_NAME
    67.  
    68. # Suppression du répertoire temporaire
    69. rm -rf $SVN_TMP_PATH/$PROJECT_NAME     
    70.  
    71. # Done !
    72. echo ""
    73. echo "Projet subversion $PROJECT_NAME créé avec succès dans $SVN_ROOT/$PROJECT_NAME !"
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2015"></script>

First / Previous / Next / Last / Page 1 of 18 (171 posteets)