Skip to content

Instantly share code, notes, and snippets.

View progressify's full-sized avatar
🇮🇹

Antonio Porcelli progressify

🇮🇹
View GitHub Profile
// From https://github.com/WebBluetoothCG/demos/blob/gh-pages/bluetooth-printer/index.html
var SERVICE = '000018f0-0000-1000-8000-00805f9b34fb';
var WRITE = '00002af1-0000-1000-8000-00805f9b34fb';
var DATA = ''
+ '\x1B' + '\x61' + '\x31' // center align
+ '\x1D' + '\x21' + '\x11' + 'Hello\nBluetooth!\n\n' // double font size
+ '\x1D' + '\x21' + '\x00' + '... from your friends\nat https://qz.io' // normal font size
+ '\n\n\n\n\n\n\n'; // feed paper
@althonos
althonos / setup.cfg
Last active March 4, 2024 18:08
A `setup.cfg` template for my Python projects
# https://gist.github.com/althonos/6914b896789d3f2078d1e6237642c35c
[metadata]
name = {name}
version = file: {name}/_version.txt
author = Martin Larralde
author_email = martin.larralde@embl.de
url = https://github.com/althonos/{name}
description = {description}
long_description = file: README.md
@abiosoft
abiosoft / Caddyfile
Created September 18, 2016 16:16
Caddy wordpress docker-compose
:80
root /usr/src/wordpress
gzip
fastcgi / wordpress:9000 php
rewrite {
if {path} not_match ^\/wp-admin
to {path} {path}/ /index.php?_url={uri}
}
log stdout
errors stderr
@Iman
Iman / clean.sh
Last active May 19, 2024 14:08
Free up disk space on Ubuntu - clean log, cache, archive packages/apt archives, orphaned packages, old kernel and remove the trash
#!/bin/sh
#Check the Drive Space Used by Cached Files
du -sh /var/cache/apt/archives
#Clean all the log file
#for logs in `find /var/log -type f`; do > $logs; done
logs=`find /var/log -type f`
for i in $logs
@gesquive
gesquive / self-update-script.py
Last active February 18, 2024 20:36
Stick this in a python script to self update the script from an online source
def update(dl_url, force_update=False):
"""
Attempts to download the update url in order to find if an update is needed.
If an update is needed, the current script is backed up and the update is
saved in its place.
"""
import urllib
import re
from subprocess import call
def compare_versions(vA, vB):
@carlohamalainen
carlohamalainen / joomla_password.py
Created May 6, 2013 03:40
Create a Joomla password hash/salt entry using Python
import getpass
import hashlib
import random
import string
password = getpass.getpass('password (not echoed): ')
salt = ''.join(random.choice(string.ascii_lowercase + string.ascii_uppercase + string.digits) for x in range(32))
password_hash = hashlib.md5(password + salt).hexdigest()
print "update CHANGEME_users set password='" + password_hash + ':' + salt + "' where id = ...;"