Skip to content

Instantly share code, notes, and snippets.

View jontey's full-sized avatar

Jonathan Tey jontey

View GitHub Profile
@jontey
jontey / wp_update_notifications_menu.php
Last active February 7, 2018 19:44
WordPress plugin to show module/theme/core update notifications in menu even when DISALLOW_FILE_MODS is TRUE.
<?php
/*
Plugin Name: Update Notifications Menu
Plugin URI: https://gist.github.com/jontey/5492a588a16162dc63ce340344f6c959
Description: WordPress plugin to show module/theme/core update notifications in menu even when DISALLOW_FILE_MODS is TRUE.
Version: 1.2
Author: Jonathan Tey
Author URI: https://gist.github.com/jontey
*/
/* Copyright 2018 Jonathan Tey
@jontey
jontey / HTMLTidy.py
Created May 31, 2018 18:47
Run Tidy2 for each html file in folder using Notepad++ and Python Script
import os;
import sys;
filePathSrc = notepad.prompt('Enter the path to the folder where the files are located', 'Convert files to UTF-8', 'C:\\');
for root, dirs, files in os.walk(filePathSrc):
for fn in files:
if fn[-5:] == '.html':
notepad.open(root + "\\" + fn)
console.write(root + "\\" + fn + "\r\n")
notepad.runPluginCommand("Tidy2", "Tidy (config 1)")
notepad.save()
@jontey
jontey / toUTF8.py
Created May 31, 2018 18:49
Convert files with selected extensions to UTF-8 using Notepad++ and Python Script plugin
import os;
import sys;
filePathSrc = notepad.prompt('Enter the path to the folder where the files are located', 'Convert files to UTF-8', 'C:\\');
for root, dirs, files in os.walk(filePathSrc):
for fn in files:
if fn[-3:] == '.js' or fn[-4:] == '.php' or fn[-4:] == '.htm' or fn[-5:] == '.html' or fn[-4:] == '.css' or fn[-4:] == '.txt':
notepad.open(root + "\\" + fn)
console.write(root + "\\" + fn + "\r\n")
notepad.runMenuCommand("Encoding", "Convert to UTF-8")
notepad.save()
@jontey
jontey / README.md
Created June 28, 2018 03:30
Setup RFID reader on your local workstation

Requirements

  1. Python2.7

  2. Node.js + npm

Steps

  1. Clone the repository on your pc

  2. Run pip install -r requirements.txt

@jontey
jontey / catapult.healthcheck.sh
Created May 7, 2019 08:33
Check health of catapult nodes
eval $(egrep -v '^#' .env | xargs) && \
docker run --rm \
-v ${CATAPULT_DIR}/build/peer_node:/userconfig \
-t jtey1/catapult-tools:with-wait \
/bin/bash -c "/catapult/bin/catapult.tools.health /userconfig"
@jontey
jontey / hosts
Created December 2, 2019 04:47 — forked from alrik11es/manage-etc-hosts.sh
Bash Script to Manage /etc/hosts file for adding/removing hostnames.
#!/usr/bin/env bash
# sudo apt-get install -y nscd
set -eu
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
@jontey
jontey / folder_plusplus.sh
Last active February 19, 2020 07:53
Increment folder name by 1
# Increment folder names from dist[i] to dist[i++]
# Delete last dist[length] folder
# curl -s https://gist.githubusercontent.com/jontey/ed81e1c719946120169d72f14f33d04b/raw/folder_plusplus.sh | sh
ls -vrl | egrep '^d' | gawk -F"dist" '{ print "mv dist" $2 " dist" $2+1}' | bash
ls -vl | egrep '^d' | tail -1 | awk '{print "rm -rf " $9}' | bash
@jontey
jontey / mojave.xml
Last active December 17, 2019 15:28 — forked from trongthanh/mojave.xml
macOS Mojave dynamic background re-implement as GTK+ background slideshow. Background images are changed to reflect the time of the day.
<!-- Instructions:
- Download and unzip Mojave dynamic background here: https://files.rb.gd/mojave_dynamic.zip
- Rename the extracted folder as "mojave-background" (Excuse the trouble but I renamed it on my machine and already use that path in the XML file)
- Save this xml file next to the Mojave background files
- Fix the path to the background images below (better using absolute path)
- Lastly, either:
+ GNOME: Use gnome-tweaks tool to select this XML as wallpaper (as default wallpaper settings won't let you choose wallpaper from custom path)
+ MATE: Go to background setting (in Appearance) > Choose +Add... > make sure **All files** filter is selected at the bottom right > Then choose mojave.xml
-->
<background>
@jontey
jontey / install_docker.sh
Last active February 10, 2020 15:00
Install the latest docker + docker-compose
curl -fsSL get.docker.com -o get-docker.sh
sh get-docker.sh
COMPOSE_VERSION=`git ls-remote https://github.com/docker/compose | grep refs/tags | grep -oP "[v]?[0-9]+\.[0-9][0-9]+\.[0-9]+$" | tail -n 1`
sudo sh -c "curl -L https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose"
sudo chmod +x /usr/local/bin/docker-compose
sudo sh -c "curl -L https://raw.githubusercontent.com/docker/compose/${COMPOSE_VERSION}/contrib/completion/bash/docker-compose > /etc/bash_completion.d/docker-compose"
# If your catapult node crash with some missing blocks, due to the way catapult broker works, the catapult index.dat is updated and buffered in memory before the block is saved to the disk.
# On the event of a node crashing, this will cause the block to be unable to recover
To start,
vim index.dat
:set binary !
:%!xxd