Skip to content

Instantly share code, notes, and snippets.

View C-Duv's full-sized avatar

Duvergier Claude C-Duv

View GitHub Profile

Symfony2 example project with:

  • Ruby (gem): manage deps (chef, cap)
  • Opscode Chef: apply config. to target system
  • Berkshelf: manage chfe deps (cookbooks)
  • Capistrano: deploy sources to server
  • composer: deps manager for php
  • Symfony 2
  • vagrant
@tentacode
tentacode / loop.php
Last active August 29, 2015 14:19
Quick & dirty loop with pcntl_fork
<?php
// every thing before will be used in every child process
while(true) {
$pid = pcntl_fork();
if ($pid === -1) {
die('Could not fork process');
} elseif ($pid) {
#!/bin/bash
CAT="/bin/cat"
HOSTNAME=$(/bin/hostname)
RABBITMQ_HOME="/var/lib/rabbitmq"
RABBITMQ_COOKIE_PATH="$RABBITMQ_HOME/.erlang.cookie"
RABBITMQ_COOKIE=$($CAT $RABBITMQ_COOKIE_PATH) || exit 1
ERLANG_ROOT="/usr/local/erlang"
ERL_CALL="$ERLANG_ROOT/lib/erlang/lib/erl_interface-3.6.5/bin/erl_call"
PROCS=$($ERL_CALL -c $RABBITMQ_COOKIE -sname rabbit@$HOSTNAME -a 'erlang system_info [process_count]')
echo "procs.$HOSTNAME $PROCS"
@Eising
Eising / findip.rb
Created February 27, 2012 13:13
Script to find IPs that belong in a list of subnets
#!/usr/bin/env ruby
require 'ipaddr'
def usage
puts "#{$0} supernets file"
puts "Checks if a file full of ip-addresses is part of a supernet \n\n"
puts "Supernets: A comma-separated list of CIDR-noted networks. NO SPACES!\n\n"
puts "Example:"
puts "#{$0} 10.0.0.0/8,172.16.0.0/12 badguys.txt"
Process.exit
@andrewrcollins
andrewrcollins / dates_times.sql
Created January 11, 2012 04:01
MySQL Dates and Times
-- ===================================================================
-- Various MySQL stored procedures for handling dates,
-- as well as populating date and time dimensions.
-- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
--
-- Date Dimension
--
@mauvm
mauvm / gist:5de07085f3b51e117378
Created July 26, 2015 11:57
An "envsubst" alternative for replacing env variables in NGinX site configurations (for using it with Docker)
#!/bin/bash
# NOTE: Brackets are not supported and '$' in values will break the script.
mkdir /etc/nginx/sites-enabled 2> /dev/null
for file in /etc/nginx/sites-available/*.conf
do
TPL=$(cat $file)
for row in $(env)
do
@nocnokneo
nocnokneo / makeImage.sh
Last active February 27, 2021 15:52 — forked from bitboxer/makeImage.sh
#!/bin/bash
# A bash script to create a time machine disk image suitable for
# backups with OS X 10.6 (Snow Leopard)
# This script probably only works for me, so try it at your own peril!
# Use, distribute, and modify as you see fit but leave this header intact.
# (R) sunkid - September 5, 2009
#
# This will create a time machine ready disk image named with your
# computer's name with a maximum size of 600GB and copy it to
# /Volumes/backup. The image "file" (it's a directory, really) will
@yunghoy
yunghoy / gist:a425f91824d26461bb2e3653bc56ebbf
Last active June 2, 2022 00:34
AMQP library (RabbitMQ) - async/await
alias babel-node='babel-node --presets stage-0'
------ RECV ------
// babel-node recv2.js "#"
// babel-node recv2.js "kern.*"
const amqp = require('amqplib');
const args = process.argv.slice(2);
if (args.length == 0) {
@zealot128
zealot128 / README.md
Last active October 5, 2022 15:39
Papercut simple replacement = IMAP to print

Papercut replacement

  • imap to print
  • use case: on a Raspi oder Office server that hangs in the same LAN like the printer and can print via cups/system using "lp"
  • just uses lp under the hood
  • uses the awesome mail_room Gem under the hood to handle imap connection, which does most of the lifting

Send Mail as a authorized return-path (via regex matching) to your mailbox, it will print all pdf Attachments.

USAGE

@fxsjy
fxsjy / SimpleAuthServer.py
Created April 26, 2013 06:23
SimpleAuthServer: A SimpleHTTPServer with authentication
import BaseHTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
import sys
import base64
key = ""
class AuthHandler(SimpleHTTPRequestHandler):
''' Main class to present webpages and authentication. '''
def do_HEAD(self):