Skip to content

Instantly share code, notes, and snippets.

View leotm's full-sized avatar

LeoTM leotm

View GitHub Profile
@leotm
leotm / symlink.sh
Created November 19, 2021 15:17
Create a hard link or a symbolic link
@leotm
leotm / reinstall_brew.sh
Created November 19, 2021 15:12
Re-install Brew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
@leotm
leotm / registerServiceWorker.ts
Created November 19, 2021 15:09
Register a service worker
navigator.serviceWorker
.register('/sw.js')
.then((reg) => console.log('SW registered', reg))
.catch((err) => console.log('rip', err))
@leotm
leotm / mysql-init.sh
Created December 12, 2016 22:46
Setup MySQL
# Check process with: ps -ef | grep mysql OR ps aux|grep mysql
pkill mysqld
mysqld_safe --skip-grant-tables &
mysql -u root
FLUSH PRIVILEGES;
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('foobar');
quit
pkill mysql_safe
service mysql start
# now u good 2 go
@leotm
leotm / default_syntax.py
Last active July 9, 2020 18:54
Sublime Text 3 - Set default syntax
# AppData\Roaming\Sublime Text 3\Packages\User\default_syntax.py
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
view.set_syntax_file('Packages/<Language>/<Language>.tmLanguage')
PODS:
- boost-for-react-native (1.63.0)
- CocoaAsyncSocket (7.6.4)
- CocoaLibEvent (1.0.0)
- DoubleConversion (1.1.6)
- FBLazyVector (0.62.2)
- FBReactNativeSpec (0.62.2):
- Folly (= 2018.10.22.00)
- RCTRequired (= 0.62.2)
- RCTTypeSafety (= 0.62.2)
@leotm
leotm / ovpnAuth.js
Last active July 25, 2018 16:53
Node.js - Add authentication to OpenVPN (.ovpn) files
var fs = require("fs");
var glob = require("glob");
glob('*.ovpn', function (err, files) {
if (err) { throw err; }
files.forEach(function(item,index,array){
// Each .ovpn file will use login.conf containing un and pw
fs.appendFile(item, ' auth-user-pass login.conf', function (err) {});
});
});
@leotm
leotm / git-bash-shell-cmd.lnk
Last active September 24, 2017 07:17
GitHub for Windows - Git Bash shell shortcut
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
leotm / restartGhost.sh
Created September 21, 2017 13:39 — forked from hyharryhuang/restartGhost.sh
Restart Ghost Blog
sudo service nginx restart
sudo service ghost restart
@leotm
leotm / insta.friendorfollow.com_bulk.js
Created August 17, 2015 12:20
Instagram - Friend or Follow - Bulk Unfollow/Follow
// 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)