Skip to content

Instantly share code, notes, and snippets.

View backup script
#!/bin/bash
source=myLogin@hostname:
snapshotDir=/path/to/backup/dir
if [ -d $snapshotDir/hourly.3 ]
then
rm -rf $snapshotDir/hourly.3
fi
View backup script daily
#!/bin/bash
snapshotDir=/path/to/backup/dir
if [ -d $snapshotDir/daily.2 ]
then
rm -rf $snapshotDir/daily.2
fi
if [ -d $snapshotDir/daily.1 ]
View base 64
$image = file_get_contents('/path/to/file');
$base64 = base64_encode($image);
echo 'data:image/png;base64,'.$base64."\n";
View base 64
<?php
// Get parameters
$arguments = $_SERVER['argv'];
array_shift($arguments);
if (empty($arguments)) {
die("File path is undefined\n");
}
$filePath = array_shift($arguments);
if (!is_file($filePath)) {
die("File not found : $filePath\n");
@neolao
neolao / gist:983196
Created May 20, 2011 15:45
Read only property
View gist:983196
public function __get($name)
{
if (method_exists($this, "get_$name")) {
return $this->{"get_$name"}();
} else if (method_exists($this, "set_$name")) {
throw new Exception("Writeonly property $name");
} else {
throw new Exception("Undefined property $name");
}
}
View gist:1040463
/* Here we go, show the magazine */
$('#viewer').booklet({
width: bookWidth * 2,
height: bookHeight,
speed: 750,
pagePadding: 0,
pageNumbers: false,
closed: true,
autoCenter: true,
@neolao
neolao / robot.js
Created December 6, 2012 17:08
neolao
View robot.js
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
this.mainInstance;
this.enemyFound = false;
setInterval(this.move, 1000);
};
Robot.prototype.move = function() {
@neolao
neolao / index.html
Last active December 13, 2015 23:59
Test comix
View index.html
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="stylesheet" href="http://cmx.io/v/0.1/cmx.css"/>
<script src="http://cmx.io/v/0.1/cmx.js"></script>
<style>.cmx-user-scene2 .cmx-text-border .cmx-path {stroke: orange}</style>
<body>
<div style="max-width:900px; -webkit-transform:rotate(0deg);">
<scene id="scene1">
<label t="translate(0,346)">
View web-font.css
@font-face {
font-family: 'BebasNeueRegular';
src: url('../fonts/BebasNeue-webfont.eot');
src: url('../fonts/BebasNeue-webfont.eot?#iefix') format('embedded-opentype'),
url('../fonts/BebasNeue-webfont.woff') format('woff'),
url('../fonts/BebasNeue-webfont.ttf') format('truetype'),
url('../fonts/BebasNeue-webfont.svg#BebasNeueRegular') format('svg');
font-weight: normal;
font-style: normal;
}
@neolao
neolao / Lead technique PHP Zend
Created July 4, 2013 14:54
Offre - Lead technique PHP Zend
View Lead technique PHP Zend
Poste de Lead technique PHP Zend chez un éditeur, dans le secteur de l'énergie, en CDI.
Vous occuperez une place stratégique au sein de la société en prenant en charge l'équipe technique.
* 80% de développement
* 20% de gestion de projet
Responsabilité de la conception et du développement d'applications client/serveur.
Environnement technique :
* PHP 5.3