Skip to content

Instantly share code, notes, and snippets.

View venu's full-sized avatar

Venugopal Thotakura venu

View GitHub Profile
import os
import sys
import subprocess
import multiprocessing
import random
import time
import logging
import traceback
import lmdb
import json
import os
import sys
import subprocess
import multiprocessing
import random
import time
import logging
import traceback
import lmdb
import json
@venu
venu / proxy_copy.go
Created February 12, 2018 13:49 — forked from jbardin/proxy_copy.go
Go TCP Proxy pattern
package proxy
import (
"io"
"log"
"net"
)
func Proxy(srvConn, cliConn *net.TCPConn) {
// channels to wait on the close event for each connection
@venu
venu / postgres_queries_and_commands.sql
Created September 15, 2017 00:04 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@venu
venu / Git Cheat Sheet
Last active December 16, 2019 12:20 — forked from adamvduke/Git Cheat Sheet
via: http://groups.google.com/group/phillycocoa/browse_thread/thread/2d05f3eac5a7d260?hl=en
revert file:
git checkout HEAD path/to/file
OR
git checkout filename
pluck one file from another branch
git checkout Branch path/to/file
<?php
use Zend\Db\Sql\Select;
// basic table
$select0 = new Select;
$select0->from('foo');
// 'SELECT "foo".* FROM "foo"';

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta charset='UTF-8'>
<meta name='keywords' content='your, tags'>
<meta name='description' content='150 words'>
<meta name='subject' content='your website's subject'>
<meta name='copyright' content='company name'>

#Introduction If you're a php developer on ubuntu, there comes the time where you have to install/reinstall your system. I did it already a few times and i decided to write down the steps for a typical web developer stack with php. This is for a developer machine and not for a live environment!

I hope it helps you too!

fyi @mheiniger and me started with an installer here: https://github.com/mheiniger/webdev-setup

@venu
venu / symfony_form_errors
Created July 3, 2013 08:25
sf 2.3 form errors
private function getFormErrorMessages(\Symfony\Component\Form\Form $form)
{
$errors = array();
if ($form->count() > 0) {
foreach ($form->all() as $child) {
/**
* @var \Symfony\Component\Form\Form $child
*/
if (!$child->isValid()) {
@venu
venu / php-utf8-test.php
Created April 13, 2013 10:15
Testing utf8 end to end
<?php
error_reporting(E_ALL);
ini_set('display_errors', true);
header('Content-Type: text/html; charset=utf-8');
$pdo = new PDO('mysql:dbname=utf8;host=localhost', 'root', '',
array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'));