Skip to content

Instantly share code, notes, and snippets.

View cabecada's full-sized avatar

Vijaykumar Jain cabecada

View GitHub Profile
@cabecada
cabecada / proutprout_names_generator.sql
Created May 28, 2018 11:09 — forked from regilero/proutprout_names_generator.sql
hoity-toity french names generator in pure postgreSQL single query
SELECT *
FROM (
SELECT
(
SELECT concat('Marie-', string_agg(x,'-')) as name_first_female
FROM (
select start_arr[ 1 + ( (random() * 100)::int) % 32 ]
FROM
(
select '{Claude,Thérèse,Géraldine,Sylvie,Sophie,Solange,Vivianne,Cunégonde,Albertine,Charlotte,Caroline,Célestine,Bérangère,Sylvianne,Alphonsine,Claire,Françoise,Chantal,Geneviève,Christine,Louise,Adeline,Céleste,Angélique,Clothilde,Jeanne,Pierre,Valentine,Paule,Noëlle,Lise,Cécile}'::text[] as start_arr
select
test,
query::char(48),
instance,
--scale,
--clients,
round(mean_time::numeric, 4) mean_time,
round(stddev_time::numeric, 4) stddev_time,
round(((mean_time - mean_time_lag)::numeric / mean_time::numeric )*100, 1) as mean_time_diff,
round(((stddev_time - stddev_time_lag)::numeric / stddev_time::numeric )*100, 1) as stddev_time_diff
@cabecada
cabecada / vm-resize-hard-disk.md
Created September 7, 2017 09:36 — forked from christopher-hopper/vm-resize-hard-disk.md
Resize a Hard Disk for a Virtual Machine provisioned using Vagrant from a Linux base box to run using VirutalBox.

Resize a Hard Disk for a Virtual Machine

Our Virtual Machines are provisioned using Vagrant from a Linux base box to run using VirutalBox. If the Hard Disk space runs out and you cannot remove files to free-up space, you can resize the Hard Disk using some VirtualBox and Linux commands.

Some assumptions

The following steps assume you've got a set-up like mine, where:

@cabecada
cabecada / postgres-cheatsheet.md
Created August 31, 2017 18:28 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@cabecada
cabecada / mongodb_3.2.x_sharding.md
Created January 30, 2017 09:54 — forked from leommoore/mongodb_3.2.x_sharding.md
MongoDB 3.2.x Sharding

#MongoDB 3.2.x Sharding Sharding is used when the database is too large to run on a single server and you need to spread the load across multiple servers. The name itself refers to the breaking (sharding) of the data into seperate groups of data which will reside on different servers.

##Configuration Server Start the server on your server (myserver0)

mongod --configsvr --dbpath /data

On myserver1 start the shard giving the configuration server as the --configdb option

@cabecada
cabecada / gist:9c73fa47fdad31ce97d333315cda946b
Created January 13, 2017 18:26 — forked from Atem18/gist:4696071
Tutorial to seting up a django website in production.

Set up Django, Nginx and Gunicorn in a Virtualenv controled by Supervisor

Steps with explanations to set up a server using:

  • Virtualenv
  • Virtualenvwrapper
  • Django
  • Gunicorn
@cabecada
cabecada / Gemfile
Created July 20, 2016 18:44 — forked from ctalkington/Gemfile
Nginx, Sinatra, and Puma.
source :rubygems
gem "puma"
gem "sinatra"