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 / 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
@mrnejc
mrnejc / node_even_listener.js
Created September 17, 2015 12:15
recipe to create event emitting class in nodejs
// created from example at http://thejackalofjavascript.com/node-js-design-patterns/
// and using nodejs.org docs
var EventEmitter = require('events').EventEmitter;
var util = require('util');
function Batter(name) {
this.name = name;
// initialize properties from EventEmitter on this instance
@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 / app.js
Created May 8, 2015 09:24
using command line parameters in node.js application
// have to have args npm package
// npm install args --save
var args = require('args');
// defining command line options
var args_options = args.Options.parse([
{
name: 'port',
shortName: 'P',
type: 'int',
@mrnejc
mrnejc / nginx_site.ini
Created March 17, 2015 15:11
nginx https 301 redirect
# copy/paste from comment at
# https://www.digitalocean.com/community/questions/http-https-redirect-positive-ssl-on-nginx
server {
listen 80;
server_name devly.co www.devly.co;
return 301 https://$server_name$request_uri;
}
server {