Skip to content

Instantly share code, notes, and snippets.

@akesterson
akesterson / 1-README.md
Last active November 9, 2024 05:26 — forked from depau/1-README.md
VitalSource web book page scraper

VitalSource web book page scraper

This pair of userscripts (to be used with any usescript manager such as ViolentMonkey) allow scraping books from the VitalSource Bookshelf web reader.

This allows creating a PDF for offline reading with free-software readers such as Calibre.

The "inner" script hooks into the book page nested iframe; it detects when a new page image is loaded and it automatically starts a browser download.

The "outer" script hooks into the main reader page and adds a "Scrape" button which automatically goes to the next page when the inner script has successfully downloaded a page.

@akesterson
akesterson / gist:6ff8049df90c1ae5ea223efc64381f82
Created May 23, 2023 15:41
script for automatically managing SSH Agent and keys
#!/bin/bash
function start_sshagent()
{
ssh-agent > ~/.sshagent
. ~/.sshagent
}
function check_sshagent() {
ps -p $SSH_AGENT_PID > /dev/null
@akesterson
akesterson / gist:ff7bcfe925b9621e47e5
Created April 23, 2015 06:05
Convert Keeper CSV exports to Lastpass CSV import
This isn't 100%, but it will get you most of the way there (assumes bash 4+):
(\
echo 'url,type,username,password,hostname,extra,name,grouping' ; \
cat KEEPER_BACKUP_FILE | sed -e s/' '/'|'/g -e s/','//g | (\
while read LINE; do \
IFS='|' read -r -a fields <<< "$LINE"; \
type="server"; \
if [[ "${fields[4]}" == "" ]]; then \
type=''; \
@akesterson
akesterson / gist:5eb9b223db4cfa3d22d4
Created January 25, 2015 02:26
8086 bootloader / kernel "load from disk and jump to kernel" problem
##### First we build from scratch ...
#######################################
akesterson@akesterson-pc:~/source/upstream/git/akesterson/piquant$ make clean all
rm -f boot.bin asm/*o src/*o
bcc -ansi -3 -c -o src/kernel.o src/kernel.c
ld86 -T0x1000 -M -o kernel.bin src/kernel.o
kernel _printString 0 0000101b R
kernel _main 0 00001049 R
kernel _printChar 0 00001000 R
Using flask-sqlalchemy 2.0 with sqlalchemy 0.9.6, and cx_Oracle 5.1.3.
The sqlalchemy engine works 100% for the other bind I'm using (a MySQL database). But I'm only using ORM on the Oracle bind.
When declaring a ORM class like this (names are redacted):
class ORMObject(db.Model):
__bind_key__ = 'bind_name'
__table_args__ = {'schema': 'SPACE'}
__tablename__ = 'TABLE_NAME'
>>> def wat():
... raise Exception("ARGH")
... yield 0
... yield 1
... yield 2
...
>>> wat()
<generator object wat at 0x2e62500>
if [ ... ]; then
do some shit
....
....
....
....
....
if [ ... ]; then
do more shit
...
@akesterson
akesterson / gist:11391984
Created April 29, 2014 06:22
Why I switched from bamboo to jenkins
TL;DR - It was proving to be more buildsystem than I needed,
and I had found that there were other buildsystems that met my needs
that I felt were lighter and more nimble. It's still a fine product
that I continue to recommend to this day, I just no longer see it as
"The One True Way".
=========================
1: Bamboo was consuming a significant amount of system resources,
@akesterson
akesterson / gist:9556321
Created March 14, 2014 20:38
Per-user mock build chroot
# Add this code to your /etc/mock/site-defaults.cfg file, and then
# all of your mock builds will take place in ${HOME}/.mockbuild/CONFIG.
# This will allow many users to build the same package config (-r)
# at any given time; so john, tom, dick and harry can build epel-5-noarch
# at the same time, and john can build epel-5-noarch, epel-6-x86_64,
# and fedora-13-x86_64 at the same time, because they all have their own
# build basedir.
# Note that this is very linux specific, YMMV on other platforms.
Vagrant::Config.run do |config|
config.vm.customize ["modifyvm", :id, "--name", "macosx.aklabs.net", "--memory", 2048]
config.vm.customize ["modifyvm", :id, "--nic2", 'bridged']
config.vm.customize ["modifyvm", :id, "--bridgeadapter2", 'eth0']
config.vm.provision :shell, :inline => 'sudo networksetup -detectnewhardware'
config.vm.provision :shell, :inline => 'sudo networksetup -setdhcp "Ethernet 2"'
config.vm.provision :shell, :inline => 'sudo pmset sleep 0'
config.vm.provision :shell, :inline => 'sudo pmset displaysleep 0'