This file contains 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 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 |
This file contains 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
# 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 |
This file contains 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
: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 |
This file contains 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 | |
#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 |
This file contains 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
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): |
This file contains 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 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 = ...;" |