Skip to content

Instantly share code, notes, and snippets.

View tomasfejfar's full-sized avatar
🏠
Working from home

Tomáš Fejfar tomasfejfar

🏠
Working from home
View GitHub Profile
@Shoozza
Shoozza / Cmder.bat
Last active May 10, 2017 10:31
Cmder.bat argument execution support
@ECHO OFF
REM Example: Cmder.bat vim hello_world.c
REM will run vim hello_world.c inside Cmder
REM Note Add following line at the end of init.bat (without REM)
REM @if not "%*" == "" %*
SET "CMDER_ROOT=%~dp0"
IF "%ConEmuDir%" == "" SET "ConEmuDir=%CMDER_ROOT%\vendor\conemu-maximus5"
START "" "%ConEmuDir%\ConEmu.exe" /Icon "%CMDER_ROOT%\icons\cmder.ico" /Title Cmder /LoadCfgFile "%CMDER_ROOT%\config\ConEmu.xml" /cmd cmd /k ""%ConEmuDir%\..\init.bat" %*" -new_console:d:%USERPROFILE%
@arun057
arun057 / gist:5556563
Created May 10, 2013 18:53
mysqldump: Couldn’t execute ‘SELECT @@GTID_MODE’: Unknown system variable ‘GTID_MODE’ (1193)
# If you are using the MySQL 5.6 version of mysqldump on an older MySQL database, you might get the error message.
mysqldump: Couldn't execute 'SELECT @@GTID_MODE': Unknown system variable 'GTID_MODE' (1193)
# This error is in part due to the introduction of Global Transaction Identifiers (GTIDs) in MySQL 5.6. GTIDs make it simple to # track and compare replication across a master-slave topology.
# mysqldump tries to query this system variable, which doesn’t exist in earlier versions, and then fails. The solution is to add # –set-gtid-purged=OFF in the mysqldump command. It should look something like
mysqldump -h dbHost -u dbuser dbName --set-gtid-purged=OFF
@jdutton
jdutton / rsyslog-to-logstash.conf
Created April 2, 2013 19:33
Rsyslog conf file to send rsyslog output to logstash as a native json logstash event. For more info - see blog post at http://untergeek.com/2012/10/11/using-rsyslog-to-send-pre-formatted-json-to-logstash/
# Send a native logstash json event to the logstash server
$template ls_json,"{%timestamp:::date-rfc3339,jsonf:@timestamp%,\"@message\":\"%msg:::json%\",\"@fields\":{%fromhost:::jsonf:host%,%syslogfacility-text:::jsonf:syslog_facility%,%syslogfacility:::jsonf:syslog_facility_code%,%syslogseverity-text:::jsonf:syslog_severity%,%syslogseverity:::jsonf:syslog_severity_code%,%app-name:::jsonf:program%,%procid:::jsonf:pid%}}"
*.* @@mylogstashhost:5543;ls_json
@gdamjan
gdamjan / README.md
Last active April 16, 2024 04:57
Setup for an easy to use, simple reverse http tunnels with nginx and ssh. It's that simple there's no authentication at all. The end result, a single ssh command invocation gives you a public url for your web app hosted on your laptop.

What

A lot of times you are developing a web application on your own laptop or home computer and would like to demo it to the public. Most of those times you are behind a router/firewall and you don't have a public IP address. Instead of configuring routers (often not possible), this solution gives you a public URL that's reverse tunnelled via ssh to your laptop.

Because of the relaxation of the sshd setup, it's best used on a dedicated virtual machine just for this (an Amazon micro instance for example).

Requirements

@tomasfejfar
tomasfejfar / mux.sh
Last active December 10, 2015 21:08
Mux SQL files
#!/bin/bash
rm -f ./mux.sql;
rm -f ./tmp.list;
RES=`echo ""`
ITEM=`echo ""`
for file in `git ls-files`
do
HASH=`git rev-list HEAD $file | tail -n 1`
DATE=`git show -s --format="%ct" $HASH --`
ITEM=$(printf "%s %s\n" $DATE $file >> tmp.list)
@Mikulas
Mikulas / Google.php
Created August 21, 2012 13:21
GoogleAuth
<?php
use \Nette\Utils\Json;
/**
* Minimalistic Google OAuth2 connector
* @author Mikuláš Dítě
* @license BSD-3
*/
class Google extends Nette\Object
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@drslump
drslump / Command.php
Created May 31, 2010 20:49
PHP Command runner class
<?php
/**
* Command building and execution
*
* Most methods implement a "fluent interface" for easy method call chaining.
*
* @see http://pollinimini.net/blog/php-command-runner/
* @author Iván -DrSlump- Montes <drslump@pollinimini.net>
* @license BSD