Skip to content

Instantly share code, notes, and snippets.

@VEnis
VEnis / Builder.php
Created December 25, 2012 13:08 — forked from mrflory/Builder.php
<?php
namespace Linkofy\CommonBundle\Menu;
use Knp\Menu\FactoryInterface;
use Symfony\Component\DependencyInjection\ContainerAware;
class Builder extends ContainerAware
{
public function mainMenu(FactoryInterface $factory, array $options)
@VEnis
VEnis / Builder.php
Created December 25, 2012 13:08 — forked from havvg/Builder.php
<?php
namespace Ormigo\Bundle\BackofficeBundle\Menu;
use Knp\Menu\FactoryInterface;
use Symfony\Component\DependencyInjection\ContainerAware;
use Ormigo\Bundle\UserBundle\Model\User\UserQuery;
use Symfony\Component\Security\Core\Role\SwitchUserRole;
@VEnis
VEnis / python_function_arguments
Last active March 11, 2018 14:43
Aggregating function arguments from inside function call
#http://kbyanc.blogspot.com/2007/07/python-aggregating-function-arguments.html
def arguments():
"""Returns tuple containing dictionary of calling function's
named arguments and a list of calling function's unnamed
positional arguments.
"""
from inspect import getargvalues, stack
posname, kwname, args = getargvalues(stack()[1][0])[-3:]
posargs = args.pop(posname, [])
@VEnis
VEnis / new_gist_file
Created September 5, 2013 20:42
Paramiko example
import paraminko
paramiko.util.log_to_file('ssh.log') # sets up logging
client = paramiko.SSHClient()
client.load_system_host_keys()
client.connect('127.0.0.1', username=username, password=password)
stdin, stdout, stderr = client.exec_command('ls -l')
import paramiko
client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect('127.0.0.1', username=username, password=password)
stdin, stdout, stderr = client.exec_command('ls -l')
@VEnis
VEnis / test.py
Created September 7, 2013 10:36
Ssh command with paramiko
import sys
import time
import select
import paramiko
host = 'test.example.com'
i = 1
#
# Try to connect to the host.
@VEnis
VEnis / gist:9918124
Created April 1, 2014 16:50
phpdoc usage example
Assume we are in directory named "demo" and we have php: >=5.3.3 installed
Download phpdoc from http://phpdoc.org/phpDocumentor.phar
1) Simple example of the source generation workflow
Go to the packagist to the page of some package. For example https://packagist.org/packages/monolog/monolog
Look of the package source code location at the top of the page. It will say "Source: https://github.com/Seldaek/monolog/tree/master" (99% it will be github)
Go to this page and download source code archive. In our example it will be https://github.com/Seldaek/monolog/archive/master.zip
Extract this archive to the some directory, for example in "source"
#!/bin/sh
# /etc/init.d/mjpg_streamer.sh
# v0.2 phillips321.co.uk
### BEGIN INIT INFO
# Provides: mjpg_streamer.sh
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: mjpg_streamer for webcam
@VEnis
VEnis / README-Template.md
Created January 1, 2018 02:51 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites