Skip to content

Instantly share code, notes, and snippets.

View esperlu's full-sized avatar

Jean-Luc Lacroix esperlu

  • Regains SCS
  • Belgium
View GitHub Profile
@esperlu
esperlu / purge_non_existing_images.sh
Last active November 13, 2018 16:55
darktable: script to purge non existing images from DB (shell version with sqlite transaction)
#!/bin/sh
DRYRUN=yes
if [ "$1" = "-p" ]; then
DRYRUN=no
fi
DBFILE=~/.config/darktable/library.db
TMPFILE=$(mktemp -t tmp.XXXXXXXXXX)
@esperlu
esperlu / purge_non_existing_images.awk.sh
Last active November 13, 2018 16:50
darktable: script to purge non existing images from DB (awk version)
#!/bin/sh
DRYRUN=yes
if [ "$1" = "-p" ]; then
DRYRUN=no
fi
DBFILE=~/.config/darktable/library.db
TMPFILE=$(mktemp -t tmp.XXXXXXXXXX)
@esperlu
esperlu / purge_non_existing_images.gawk.sh
Last active November 13, 2018 16:52
darktable: script to purge non existing images from DB (gawk version)
#!/bin/sh
DRYRUN=yes
if [ "$1" = "-p" ]; then
DRYRUN=no
fi
DBFILE=~/.config/darktable/library.db
TMPFILE=$(mktemp -t tmp.XXXXXXXXXX)
The MIT License (MIT)
Copyright (c) 2015 esperlu
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@esperlu
esperlu / mysql2sqlite.lua
Created May 26, 2011 14:09
MySQL to Sqlite converter in Lua
#! /usr/bin/lua
-- Usage: mysql2sqlite.lua [data base name]
-- $ ./mysql2sqlite.lua my_database
-- $ ./mysql2sqlite.lua "my_database my_table"
-- $ ./mysql2sqlite
-- Set here the path to the temp file you want mysqldump to dump the database into
local mysqldump_file = '/tmp/lua.sql'
@esperlu
esperlu / mysql2sqlite.sh
Created April 27, 2011 05:46
MySQL to Sqlite converter
#!/bin/sh
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the
# CREATE block and create them in separate commands _after_ all the INSERTs.
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk.
# The mysqldump file is traversed only once.
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite