Skip to content

Instantly share code, notes, and snippets.


Leo Taifa Merinen leotm

Block or report user

Report or block leotm

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
leotm / findAndReplace.js
Last active Feb 15, 2020
Node.js - Find and Replace file(s)
View findAndReplace.js
var glob = require('glob');
var fs = require('fs');
var replace = require('replace');
// Find file(s)
glob('fileName.txt', function(err, files) {
if (err) { throw err; }
files.forEach(function(item, index, array) {
console.log(item + ' found');
leotm /
Last active Oct 27, 2019
Sublime Text 3 - Set default syntax
# AppData\Roaming\Sublime Text 3\Packages\User\
import sublime, sublime_plugin
class DefaultSyntaxCommand(sublime_plugin.EventListener):
def on_new(self, view):
# Replace <Language> with desired default language
# Check in AppData\Local\Sublime Text 3\Cache
leotm / ovpnAuth.js
Last active Jul 25, 2018
Node.js - Add authentication to OpenVPN (.ovpn) files
View ovpnAuth.js
var fs = require("fs");
var glob = require("glob");
glob('*.ovpn', function (err, files) {
if (err) { throw err; }
// Each .ovpn file will use login.conf containing un and pw
fs.appendFile(item, ' auth-user-pass login.conf', function (err) {});
leotm / gist:d5b44be19b7cea524701dd93bf02c4cf
Created Jul 17, 2018 — forked from paulirish/gist:4158604
Learn JavaScript concepts with recent DevTools features
View gist:d5b44be19b7cea524701dd93bf02c4cf

Learn JavaScript concepts with the Chrome DevTools

Authored by Peter Rybin , Chrome DevTools team

In this short guide we'll review some new Chrome DevTools features for "function scope" and "internal properties" by exploring some base JavaScript language concepts.


Let's start with closures – one of the most famous things in JS. A closure is a function, that uses variables from outside. See an example:

leotm / git-bash-shell-cmd.lnk
Last active Sep 24, 2017
GitHub for Windows - Git Bash shell shortcut
View git-bash-shell-cmd.lnk
Target: C:\Windows\System32\cmd.exe /c ""C:\Users\<User>\AppData\Local\GitHub\<Git folder>\bin\sh.exe" --login -i"
Start in: C:\Users\<User>\Documents\GitHub
leotm /
Created Sep 21, 2017 — forked from hyharryhuang/
Restart Ghost Blog
sudo service nginx restart
sudo service ghost restart
leotm / insta.friendorfollow.com_bulk.js
Created Aug 17, 2015
Instagram - Friend or Follow - Bulk Unfollow/Follow
View insta.friendorfollow.com_bulk.js
// So I wrote this purely to reverse getting hacked
// Resulting in following an extra 800 random people
// Always de-activate third-party tools after API authorisation!
// Enter into your browser console
var items = document.querySelectorAll("#content > div > img");
for (var i = 0; i < items.length; i++) {
// Simulates mouse hover over user images to open tooltips
// (Prevously tried amending the results classes and attributes)
leotm / ghost
Created Jul 24, 2017
Original file which worked with HTTPS before went down
View ghost
# /etc/nginx/sites-available/ghost
server {
listen 80;
location ~ ^/.well-known {
root /var/www/ghost;
leotm /
Created Jul 12, 2017
Remove all traces of Let's Encrypt
rm -rf /path/to/your/git/clone/directory
rm -rf ~/.local/share/letsencrypt
rm -rf /etc/letsencrypt
rm -rf /var/log/letsencrypt
rm -rf /var/lib/letsencrypt
rm -rf ~/letsencrypt.log
rm -rf ~/.local/share/letsencrypt
leotm /
Created Mar 29, 2017
A shell script that creates an associate array and generates prefixed php files that redirect to the matching URLs
# How to iterate over associate arrays in Bash
# To generate PHP redirection files with prefixes
declare -A array
for i in "${!array[@]}"
You can’t perform that action at this time.