Skip to content

Instantly share code, notes, and snippets.

@lgrz
lgrz / db_add
Created February 5, 2010 04:00
bash scripts - apache, mysql
#!/usr/bin/env bash
#
# db_add
# A script to configure a new database
#
if [[ $# -lt 2 ]]
then
echo "usage: db_add <db-name> <db-server> [db-host]"
echo "example 1 connect from localhost: db_add \"db-name\" \"db-server\" \"localhost\""
/*
* ShortCut
* Mini routing for jQuery
*/
(function($){
$.shortCut = function(settings){
var defaults = {
controller: false,
init: false,
element: $('body'),
@beberlei
beberlei / Document.php
Created May 18, 2011 10:46
My Symfony2 File Upload workflow
<?php
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\HttpFoundation\File\UploadedFile;
/**
* @Entity
*/
class Document
{
@beberlei
beberlei / MyWebTestCase.php
Created September 17, 2011 12:14
Easily Inject authenticated Symfony User into functional test
<?php
use Liip\FunctionalTestBundle\Test\WebTestCase;
use Symfony\Component\HttpKernel\Profiler\Profiler;
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
use Symfony\Component\Security\Core\User\UserInterface;
/**
* @group functional
*/
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Responsive Design Testing</title>
<style>
body { margin: 20px; font-family: sans-serif; overflow-x: scroll; }
.wrapper { width: 6000px; }
.frame { float: left; }
h2 { margin: 0 0 5px 0; }
@lgrz
lgrz / deploy.rb
Created August 7, 2012 00:43
Collection of Capifony tasks
after "deploy:restart", "deploy:cleanup"
after "deploy:setup", "symfony:setup:parameters_init"
# Clear the cache before the cache:warmup task is run. The cache directory is
# shared, that way setting ACL's only happens once and we avoid the use of
# sudo
before 'deploy:finalize_update', 'symfony:cache:remove'
namespace :symfony do
namespace :cache do
@dbu
dbu / Vagrantfile
Created November 13, 2012 09:26
vagrant setup
# -*- mode: ruby -*-
# vi: set ft=ruby :
this_dir = File.dirname(__FILE__) + "/"
require this_dir + "vagrant/hostmaster.rb"
Vagrant::Config.run do |config|
# define some colors for our output
def colorize(text, color_code) "#{color_code}#{text}\033[0m" end
@lgrz
lgrz / phpman
Last active December 29, 2015 15:19
#!/bin/bash
BROWSER="links"
PHPDOC="/path/to/doc/php/"
if [ "$#" -ne 1 ]; then
echo "usage: phpman class|function"
exit
fi
@gyglim
gyglim / tensorboard_logging.py
Last active August 23, 2023 21:29
Logging to tensorboard without tensorflow operations. Uses manually generated summaries instead of summary ops
"""Simple example on how to log scalars and images to tensorboard without tensor ops.
License: BSD License 2.0
"""
__author__ = "Michael Gygli"
import tensorflow as tf
from StringIO import StringIO
import matplotlib.pyplot as plt
import numpy as np
@palopezv
palopezv / dwm_config_pulseaudio.h
Last active June 19, 2024 15:52 — forked from neuro-sys/dwmconfig.h
dwm volume control with hardware multimedia keys (pipewire, pulseaudio, amixer and light as an extra)
/**
* dwmconfig.h
* Hardware multimedia keys
*/
/* Somewhere at the beginning of config.h include: */
/*
You obviously need the X11 development packages installed, X11proto in particular, but
here is the location of the keysyms header upstream copy if you can't bother
using the contents of your own hard drive. ;-P