Skip to content

Instantly share code, notes, and snippets.

@mrnejc
mrnejc / comictagger-cli-edit-tags.sh
Created June 4, 2023 10:31
extract metadata from filename and fill CBZ data with comictagger application
#!/bin/bash
# script requires comictagger-cli in path (https://github.com/comictagger/comictagger)
# save the default field separators so we can work with spaces in filenames
SAVEIFS="$IFS"
IFS=$(echo -en "\n\b")
declare -A NUMTOMON
NUMTOMON["01"]="January"
NUMTOMON+=( ["02"]="February" ["03"]="March" ["04"]="April" ["05"]="May" ["06"]="June" ["07"]="July" ['08']="August" ["09"]="September" ["10"]="October" ["11"]="November" ["12"]="December" )
@mrnejc
mrnejc / pdf2cbz_gs.sh
Created June 4, 2023 10:18
Convert PDF to CBZ archives via GhostScript; run with --help for some help
#!/bin/bash
# take care of spaces in filenames
SAVEIFS="$IFS"
IFS=$(echo -en "\n\b")
# requires ghostscript, ionice, zip, jhead & imagemagick/graphicsmagick
# do not delete temp directory with temp files
DELETE=false
# do not up/down-scale images
@mrnejc
mrnejc / pdf2cbz_gs.sh
Created December 23, 2022 15:44
convert PDF to CBZ via GhostScript, some parameters can be set (requires ghostscript, ionice, zip, jhead & imagemagick/graphicsmagick)
#!/bin/bash
SAVEIFS="$IFS"
IFS=$(echo -en "\n\b")
# requires ghostscript, ionice, zip, jhead & imagemagick/graphicsmagick
# do not delete temp directory with temp files
DELETE=false
# default resolution is 150 dpi
PDF_RES=150
@mrnejc
mrnejc / ComicInfo.xsd
Last active August 30, 2020 10:23 — forked from vaemendis/ComicInfo.xsd
ComicRack metadata schema
<?xml version="1.0" encoding="utf-8"?>
<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="ComicInfo" nillable="true" type="ComicInfo" />
<xs:complexType name="ComicInfo">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="1" default="" name="Title" type="xs:string" />
<xs:element minOccurs="0" maxOccurs="1" default="" name="Series" type="xs:string" />
<xs:element minOccurs="0" maxOccurs="1" default="" name="Number" type="xs:string" />
<xs:element minOccurs="0" maxOccurs="1" default="-1" name="Count" type="xs:int" />
<xs:element minOccurs="0" maxOccurs="1" default="-1" name="Volume" type="xs:int" />
Verifying my Blockstack ID is secured with the address 1XyKq7bG4o5xTDUJM8xruwvCd1y4Xjehk https://explorer.blockstack.org/address/1XyKq7bG4o5xTDUJM8xruwvCd1y4Xjehk
@mrnejc
mrnejc / random_string.sh
Last active January 21, 2016 10:47
bash: generate random string of variable lengthdefault string length is 64 if not provided as 1st parameter
#!/bin/bash
V=$1
if [ "$V" -eq "$V" ] 2>/dev/null
then
LEN=$1
else
LEN=64
fi
echo $(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w $LEN | head -n 1)
@mrnejc
mrnejc / hash_password.py
Created November 16, 2013 19:19
python - create password hash / test password against hash
import uuid
import hashlib
def hash_password(password, version=1, salt=None):
if version == 1:
if salt == None:
salt = uuid.uuid4().hex[:16]
hashed = salt + hashlib.sha1( salt + password).hexdigest()
# generated hash is 56 chars long
return hashed
[unix_http_server]
file=/tmp/supervisor.sock ; path to your socket file
[supervisord]
logfile=/var/log/supervisord/supervisord.log ; supervisord log file
logfile_maxbytes=50MB ; maximum size of logfile before rotation
logfile_backups=10 ; number of backed up logfiles
loglevel=error ; info, debug, warn, trace
pidfile=/var/run/supervisord.pid ; pidfile location
nodaemon=false ; run supervisord as a daemon
@mrnejc
mrnejc / findbeforedate.txt
Created September 6, 2012 12:27
find files before certain date
$ touch -t [[CC]YY]MMDDhhmm[.ss] ~/date
$ find /here/be/path/to/search ! -newer ~/date
@mrnejc
mrnejc / gemini.js
Last active October 8, 2015 22:15
(quick and dirty) Gemini bitcoin exchange order-book listrequires node, run with node gemini.js
var https = require('https');
var options = {
hostname: 'api.gemini.com',
port: 443,
method: 'GET',
path: '/v1/book/btcusd'
};
var rLimit = 10; // number of results