Skip to content

Instantly share code, notes, and snippets.

@goruck
goruck / ssh-tunnel-start.sh
Last active September 21, 2022 14:47
Script to create a ssh tunnel from an AWS Lambda function to a remote host via an AWS EC2 instance.
#!/bin/sh
# Script to start a ssh tunnel via an AWS EC2 instance.
# Copyright (C) 2017 Lindo St. Angel.
# Must be called after the instance is setup by ssh-tunnel.sh
# Include global variables:
# EC2_MACH - EC2 machine type
# EC2_TYPE - EC2 instance type
@Kartones
Kartones / postgres-cheatsheet.md
Last active August 17, 2025 10:54
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -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)
@bjo3rnf
bjo3rnf / EntityHiddenType.php
Last active November 19, 2021 17:19
Hidden field for Symfony2 entities
<?php
namespace Dpn\ToolsBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Dpn\ToolsBundle\Form\DataTransformer\EntityToIdTransformer;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Doctrine\Common\Persistence\ObjectManager;