Skip to content

Instantly share code, notes, and snippets.

View SubOptimal's full-sized avatar
🤓
the joy of coding - happy hacking

Frank Dietrich SubOptimal

🤓
the joy of coding - happy hacking
View GitHub Profile
@mjg123
mjg123 / Demos.java
Created July 25, 2019 11:53
Java code demonstrating how to generate HOTP and TOTP codes. Used in my talk 2FA 2Furious
package lol.gilliard;
import com.amdelamar.jotp.OTP;
import com.amdelamar.jotp.type.Type;
import java.io.IOException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
// This code uses Austin Delamar's JOTP: https://github.com/amdelamar/jotp
@ajumalp
ajumalp / Install Mosquitto MQTT on Synology NAS Server.txt
Last active May 2, 2024 03:00
Install Mosquitto MQTT on Synology NAS Server
From https://synocommunity.com add http://packages.synocommunity.com to your NAS package sources.
For that, go to NAS->Package Cnter->Click Settings->Package Sources tab.
Then from the community, you can see Mosquitto. Install it.
After installing, please stop the Mosquitto service before updating configuration. You can start service after changes.
Enable Admin login for Synology
Enable SSH in NAS
Download putty and connect to NAS Server
Login using admin
Change to root user [sudo -i, {use admin password}]
Find mosquitto.conf file [find / -name mosquitto.conf]
@eby
eby / ansible-fact.sh
Last active April 26, 2024 17:58
Get OS version for an inventory with ad-hoc ansible
# The setup command allows filtering facts
# More info: https://docs.ansible.com/ansible/latest/modules/setup_module.html
# inventory_file = path to inventory file (if not normal role layout)
# host_group = group to query. use all for all hosts
ansible -i inventory_file host_group -m setup -a 'filter=ansible_distribution_version'
# For a Ubuntu Bionic Host the distribution facts look like this:
# "ansible_distribution": "Ubuntu",
# "ansible_distribution_file_parsed": true,
# "ansible_distribution_file_path": "/etc/os-release",
@dcode
dcode / GitHub Flavored Asciidoc (GFA).adoc
Last active April 20, 2024 13:55
Demo of some useful tips for using Asciidoc on GitHub

GitHub Flavored Asciidoc (GFA)

@barentsen
barentsen / gist:bacd4360fb31e7456d659d07b014e834
Created June 21, 2016 09:01
How to get clickshare working on Ubuntu 16.04
sudo apt install libresample1
wget http://mirrors.kernel.org/ubuntu/pool/universe/liba/libav/libavutil52_9.18-0ubuntu0.14.04.1_amd64.deb
sudo dpkg -i libavutil52_9.18-0ubuntu0.14.04.1_amd64.deb
wget http://mirrors.kernel.org/ubuntu/pool/universe/liba/libav/libswscale2_9.18-0ubuntu0.14.04.1_amd64.deb
sudo dpkg -i libswscale2_9.18-0ubuntu0.14.04.1_amd64.deb
wget https://www.dropbox.com/s/gg2i5wszrqkhzy8/clickshare_01.07.01-79_amd64.deb?dl=0#
sudo dpkg -i clickshare_01.07.01-79_amd64.deb
@subfuzion
subfuzion / global-gitignore.md
Last active May 5, 2024 19:34
Global gitignore

There are certain files created by particular editors, IDEs, operating systems, etc., that do not belong in a repository. But adding system-specific files to the repo's .gitignore is considered a poor practice. This file should only exclude files and directories that are a part of the package that should not be versioned (such as the node_modules directory) as well as files that are generated (and regenerated) as artifacts of a build process.

All other files should be in your own global gitignore file:

  • Create a file called .gitignore in your home directory and add any filepath patterns you want to ignore.
  • Tell git where your global gitignore file is.

Note: The specific name and path you choose aren't important as long as you configure git to find it, as shown below. You could substitute .config/git/ignore for .gitignore in your home directory, if you prefer.

@mmmaly
mmmaly / ssh-certificate-setup
Last active March 11, 2017 20:20
Use ssh certificates to set up a forced command for a simple server monitoring with one-year validity.
# Create the "certification authority". The private key of CA does not have to (and must not) be copied anywhere.
user@home$ ssh-keygen /home/user/.ssh/certification_authority
# Make CA public key trusted on a server.
user@home$ scp /home/user/.ssh/certification_authority.pub root@server:
root@server# cd; (echo -n "cert-authority "; cat certification_authority.pub ) >> .ssh/authorized_keys
# Generate a certificate for any command you can think of
# Example -- command: "tailf /var/log/messages" validity: 52 weeks from now Permissions: none (no forwarding etc.)
user@home$ ssh-keygen -f tailfmessages.key
# ps1
if true; then
OFF="\[\033[0m\]"
BLACK="\[\033[0;30m\]"
RED="\[\033[0;31m\]"
GREEN="\[\033[0;32m\]"
YELLOW="\[\033[0;33m\]"
BLUE="\[\033[0;34m\]"
MAGENTA="\[\033[0;35m\]"
CYAN="\[\033[0;36m\]"