Skip to content

Instantly share code, notes, and snippets.

View leotm's full-sized avatar

LeoTM leotm

View GitHub Profile
@leotm
leotm / ovpnSort.js
Last active February 5, 2016 11:25
Node.js - IPVanish - OpenVPN - Sort .ovpn config files into folders by Country
// This will sort all IPVanish config/.ovpn files (e.g. ipvanish-BE-Brussels-bru-b01.ovpn)
// into respective folders (e.g. ipvanish-BE)
var glob = require('glob');
var fs = require('fs');
glob('*.ovpn', function(err, files) {
if (err) { throw err; }
files.forEach(function(item, index, array) {
// Create the folders
@leotm
leotm / login.conf
Last active February 5, 2016 11:47
OpenVPN server authentication with .ovpn files
// For automated authentication of .ovpn files
<username>
<password>
// Ensure login.conf is in the same directory as your .ovpn file
// Add the arguments 'auth-user-pass login.conf' to your .ovpn file
// To batch edit this multiple files, see: gist.github.com/leotm/377efbde1e7037bbebfa
$ `bash`
$ ssh <username>@<host> -p<port>
# Causes hang
$ bash
$ ssh <username>@<host> -p<port>
# Works
$ `ssh-agent`
bash: SSH_AUTH_SOCK=/tmp/ssh-ic83uMHi6MDg/agent.4932;: No such file or directory
@leotm
leotm / php_check.php
Last active June 12, 2016 18:00
PHP Options/Info Functions
// It seems PDO attributes are set per connection establishment
// Rather than checking if the attribute is what we desire first, if so not executing it at all
// So I wondered, should the PHP options be just set each connection like PDO?
// Refresh
var_dump(memory_get_usage()); // 167704
if (ini_get('error_reporting') != '22527')
ini_set('error_reporting', 'E_ALL');
var_dump(memory_get_usage()); // 167704
@leotm
leotm / ChromePhpbug.php
Created June 16, 2016 21:41
ChromePhp tab bug
( ! ) Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\rndsquare.com\profile-edit.php:35) in C:\xampp\htdocs\rndsquare.com\inc\ChromePhp.php on line 394
Call Stack
# Time Memory Function Location
1 0.0006 187872 {main}( ) ...\profile-edit.php:0
2 0.0056 334032 ChromePhp::log( ) ...\profile-edit.php:35
3 0.0056 334320 ChromePhp::_log( ) ...\ChromePhp.php:161
4 0.0057 338832 ChromePhp->_addRow( ) ...\ChromePhp.php:274
5 0.0057 339384 ChromePhp->_writeHeader( ) ...\ChromePhp.php:389
From
@leotm
leotm / options.dopt
Created September 14, 2016 20:07
Darksiders 2560x1440 resolution (1440p)
444f 5054 0004 0000 0056 604a 5801 2121
0100 0001 0101 0137 0000 00a0 0500 0000
0a00 0000 0040 3f
@leotm
leotm / options.dopt
Created September 14, 2016 20:07
Darksiders 2560x1440 resolution (1440p)
444f 5054 0004 0000 0056 604a 5801 2121
0100 0001 0101 0137 0000 00a0 0500 0000
0a00 0000 0040 3f
@leotm
leotm / mysql-connector-java-5.1.39.zip
Created September 20, 2016 13:13
MySQL Connector/J 5.1.39
Home: https://dev.mysql.com/downloads/connector/j/
Download: https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.39.zip
@leotm
leotm / undo-all-facebook-ad-preferences.js
Last active December 3, 2016 00:51
How to Undo/Remove/Delete All Facebook Ad Preferences via the Console
/**
* @undo-all-facebook-ad-preferences.js
* Undo/Remove/Delete All Facebook Ad Preferences.
* Page: 'Your Ad Preferences'
* URL: https://www.facebook.com/ads/preferences/
* Instructions: Just paste each section to your Console.
*/
// Expand each Category
var selector = "div > div > div > div > ul > li";
Options +FollowSymLinks
RewriteEngine on
# beautiful addr/location bar
RewriteRule ^profile/(.*)/(.*)/?$ profile.php?id=$1&name=$2 [B]
# no need to see dem file ext.'s
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}/index.php !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]