Skip to content

Instantly share code, notes, and snippets.

@josuecau
josuecau / firewall.sh
Last active December 20, 2015 15:59
/etc/init.d/firewall
#!/bin/bash
### BEGIN INIT INFO
# Provides: firewall
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Démarre les règles iptables
# Description: Charge la configuration du pare-feu iptables
@josuecau
josuecau / display-errors.php
Last active December 23, 2015 21:29
PHP display errors
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
?>
@josuecau
josuecau / curl-get.php
Created October 11, 2013 07:49
cURL PHP examples
<?php
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'http://domain.tld');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$return = curl_exec($curl);
curl_close($curl);
@josuecau
josuecau / find-replace-osx.sh
Created October 21, 2013 13:42
Sed find/replace on Mac OS X
sed -i.backup -e 's/foo/bar/g' test.txt
@josuecau
josuecau / wget-recursive.sh
Created December 1, 2013 11:10
Using wget to recursively fetch a directory
wget -r --no-parent http://localhost/
@josuecau
josuecau / .jshintrc
Last active September 11, 2022 18:01 — forked from haschek/.jshintrc
JSHint configuration file
{
// --------------------------------------------------------------------
// JSHint Configuration, Strict Edition
// --------------------------------------------------------------------
//
// This is a options template for [JSHint][1], using [JSHint example][2]
// and [Ory Band's example][3] as basis and setting config values to
// be most strict:
//
// * set all enforcing options to true
@josuecau
josuecau / .ackrc
Last active January 2, 2016 09:28 — forked from kevinold/.ackrc
--ignore-file=is:tags
@josuecau
josuecau / responsive-images.css
Created January 11, 2014 13:46
Responsive Images with CSS
img { max-width: 100%; height: auto; width: auto; box-sizing: border-box; }
@josuecau
josuecau / text-selection.css
Created January 11, 2014 13:52
Overriding The Default Text Selection Color With CSS
::selection { background: yellow; color: black; }
::-moz-selection { background: yellow; color: black; }
@josuecau
josuecau / rate-limiter.js
Last active January 3, 2016 04:09
Rate limiter pattern implementation with Node.js and Redis
var redis = require('redis'),
client = redis.createClient(),
key = 'counter',
expire = 60,
max = 5
client.get(key, function (err, counter) {
if (counter !== null && counter > max) {
console.log('Too many calls')