Skip to content

Instantly share code, notes, and snippets.

@CaptSolo
CaptSolo / get_app_data.js
Last active August 29, 2017 20:28
Retrieve AppStore app information (command line)
#!/usr/bin/env node
var util = require('util');
var store = require('app-store-scraper');
function print_usage() {
console.log(util.format("\nUsage: %s app_store_id\n\nPrints information about the AppStore application with the given ID.\n", process.argv[1]));
}
function get_app_data(appId) {
@CaptSolo
CaptSolo / roles-example.rdf
Created May 15, 2018 20:25
RDF data example - contributor roles
<rdf:RDF xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dct="http://purl.org/dc/terms/" xmlns:edm="http://www.europeana.eu/schemas/edm/" xmlns:mods="http://www.loc.gov/mods/modsrdf/v1#" xmlns:owl="http://www.w3.org/2002/07/owl#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns:bibo="http://purl.org/ontology/bibo/" xmlns:skos="http://www.w3.org/2004/02/skos/core#" xmlns:ore="http://www.openarchives.org/ore/terms/" xmlns:viaf="http://viaf.org/viaf/" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:RdaGr2="http://RDVocab.info/ElementsGr2/" xmlns:nfo="http://www.semanticdesktop.org/ontologies/2007/03/22/nfo/#" xmlns:exif="http://www.w3.org/2003/12/exif/ns#">
<rdf:Description rdf:about="http://dom.lndb.lv/data/obj/60316">
<rdf:type rdf:resource="http://www.openarchives.org/ore/terms/Aggregation" />
<dc:title>Raiņa vēstule Aspazijai Rīgā, 1894. gada 4.februārī : teksts un komentāri</dc:title>
@CaptSolo
CaptSolo / solve_me.py
Created November 1, 2019 11:42
CyberChess CTF task - Central African Republic
# Title:
# capture Central African Republic (flag) - Math is hard
#
# Description:
# You can do this on a paper, or you can let computers solve this for you.
# Python file:
from zlib import crc32
@CaptSolo
CaptSolo / pymarc_robust_test.py
Created November 15, 2019 11:22
How to catch / ignore PyMARC exceptions
#!/bin/python
from pymarc import MARCReader
# Wrapper from https://stackoverflow.com/questions/13653783/how-to-catch-an-exception-in-the-for-loop-iterator
def wrapper(gen):
while True:
try:
yield next(gen)
except StopIteration:
@CaptSolo
CaptSolo / gist:5201b51d726b8eae388e105889b6d270
Created March 25, 2024 07:20
Obsidian Templater code for a list of Gmail e-mails from a particular week
<%*
// assuming the current file is titled in the format YYYY-Wxx (where xx is the week number)
date1 = tp.date.weekday("YYYY/MM/DD", 0, tp.file.title, "YYYY-[W]W");
date2 = tp.date.weekday("YYYY/MM/DD", 6, tp.file.title, "YYYY-[W]W");
url = "https://mail.google.com/mail/u/0/#search/" + encodeURIComponent(`after:${date1}+before:${date2}`);
tR += `[E-mails from this week](${url})\n`;
%>
@CaptSolo
CaptSolo / .zshrc
Created January 29, 2025 15:36
My zsh config
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:$HOME/.local/bin:/usr/local/bin:$PATH
# Path to your Oh My Zsh installation.
export ZSH="$HOME/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time Oh My Zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes