Skip to content

Instantly share code, notes, and snippets.

View evokateur's full-sized avatar

Wesley C. Hinkle evokateur

  • MultiEmployer.com
  • Oakland CA
  • 10:40 (UTC -07:00)
View GitHub Profile
@scy
scy / opening-and-closing-an-ssh-tunnel-in-a-shell-script-the-smart-way.md
Last active March 15, 2024 11:26
Opening and closing an SSH tunnel in a shell script the smart way

Opening and closing an SSH tunnel in a shell script the smart way

I recently had the following problem:

  • From an unattended shell script (called by Jenkins), run a command-line tool that accesses the MySQL database on another host.
  • That tool doesn't know that the database is on another host, plus the MySQL port on that host is firewalled and not accessible from other machines.

We didn't want to open the MySQL port to the network, but it's possible to SSH from the Jenkins machine to the MySQL machine. So, basically you would do something like

ssh -L 3306:localhost:3306 remotehost

@gabrielelana
gabrielelana / Vagrantfile
Last active January 2, 2024 18:58
How to create a VirtualBox machine with encrypted storage with Vagrant
# -*- mode: ruby -*-
# vi: set ft=ruby :
PASSWORD_PATH = ".password"
PASSWORD_ID_PATH = ".password_id"
# Make sure to have installed vagrant-triggers plugin
# > vagrant plugin install vagrant-triggers
# After the first `vagrant up` stop the VM and execute the following steps
@MCF
MCF / sqlsrv_test.php
Last active July 24, 2023 03:05
PDO sqlsrv PHP driver, connect and query SQL Server database - reduced test case.
<?php
$serverName = "sqlserver.example.com";
$database = "myDbName";
$uid = 'sqlserver_username';
$pwd = 'password';
try {
$conn = new PDO(
"sqlsrv:server=$serverName;Database=$database",
$uid,
@n8finch
n8finch / wp-strictly-mu-plugins-plugins-themes-gitignore
Last active April 18, 2023 19:06
This gitignore will ignore anything that isn't in mu-plugins, plugins, and themes directories of your wp-content directory.
# Ignore everything in the root except the "wp-content" directory.
/*
!.gitignore
!wp-content/
# Ignore everything in the "wp-content" directory, except the "mu-plugins", "plugins", and "themes" directories.
wp-content/*
!wp-content/mu-plugins/
!wp-content/plugins/
!wp-content/themes/
@n8finch
n8finch / no-wp-core-gitignore
Created December 16, 2020 15:28
This is a gist for to ignore WordPress core files, and some other selected files.
*~
.DS_Store
.svn
.cvs
*.bak
*.swp
Thumbs.db
# wordpress specific
wp-config.php
@int128
int128 / post.md
Last active August 7, 2021 04:24
How to use Ruby on Cygwin

How to use Ruby on Cygwin

It is strongly recommended to run on Linux or OS X. Maybe many problems will happen.

Prerequisite

  • Cygwin
  • apt-cyg
  • http_proxy is set if needed