This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Create a user on the Openfire XMPP server | |
Enable REST API by logging into admin portal (e.g. https://xmpp.devdungeon.com:9090) and go to `Plugins` and then `Available Plugins`. Enable the `REST API`. | |
Then go to `Server | Server Settings | REST API` and change it to `Enabled`. | |
Choose `Secret key auth` option and store that key. | |
(http 9090, https 9091) | |
POST https://example.org:9091/plugins/restapi/v1/users |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from requests import get # pip install requests | |
""" | |
Examples: | |
Docs: | |
- Create email (add_pop): https://documentation.cpanel.net/display/DD/UAPI+Functions+-+Email%3A%3Aadd_pop | |
- Delete email (delete_pop): https://documentation.cpanel.net/display/DD/UAPI+Functions+-+Email%3A%3Adelete_pop | |
- Change pass (passwd_pop): https://documentation.cpanel.net/display/DD/UAPI+Functions+-+Email%3A%3Apasswd_pop |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/bash | |
sudo apt install -y cifs-utils | |
# `uid` and `gid` is the local Linux user and group you want to mount as | |
# `user` and `password` are the SMB drive credentials. Wrap password with quotes if necessary. | |
sudo mount -t cifs -o uid=dano,gid=sudo,user=dano,password="my password" \\\\10.0.0.99\\home /mnt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Requires executable bit | |
# Move to `/etc/grub.d/99_dano_grub_colors` | |
# and run `sudo update-grub` | |
echo "set menu_color_normal=light-cyan/dark-gray" | |
echo "set menu_color_highlight=dark-gray/light-cyan" | |
echo "set color_normal=white/black" | |
echo "set color_highlight=black/white" | |
# To change image, update `/etc/default/grub` with the image path |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Given a directory full of gzipped AVI files, | |
* outpu a JSON array with the list of zipped video files in the dir. | |
* | |
* If a GET query param is provided for `file` then that specific | |
* file is returned, uncompressed, with the .gz extension removed | |
*/ | |
if (isset($_GET['file'])) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests # pip install requests | |
# Adapted from answer at: https://stackoverflow.com/questions/16694907/download-large-file-in-python-with-requests | |
def download(url, filepath): | |
with requests.get(url, stream=True) as response: | |
response.raise_for_status() | |
with open(filepath, 'wb') as output_file: | |
for chunk in response.iter_content(chunk_size=8192): | |
# If you have chunk encoded response, then uncomment | |
# the `if` statement and set chunk_size parameter to `None`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
REM http://nssm.cc | |
nssm.exe install "MyCustomService" "C:\Users\nanodano\venv\Scripts\python.exe" "C:\Users\nanodano\myscript.py" | |
nssm.exe start MyCustomService | |
nssm.exe stop MyCustomService | |
nssm.exe remove "MyCustomService" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pip install waitress | |
waitress-serve --listen=127.0.0.1:8001 my_wsgi_project:app --url-prefix=/my-app |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pip install waitress | |
import os | |
from waitress import serve | |
from my_wsgi_project import app # Import your app | |
# Run from the same directory as this script | |
this_files_dir = os.path.dirname(os.path.abspath(__file__)) | |
os.chdir(this_files_dir) | |
# `url_prefix` is optional, but useful if you are serving app on a sub-dir |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Open a TCP port | |
firewall-cmd --add-port=8009/tcp --permanent | |
firewall-cmd --reload | |
# Inspect current rules and zones | |
firewall-cmd --list-all | |
firewall-cmd --list-ports | |
firewall-cmd --list-services | |
firewall-cmd --list-all-zones |