Skip to content

Instantly share code, notes, and snippets.

View palevell's full-sized avatar

Patrick Allan palevell

View GitHub Profile
@palevell
palevell / pick_random_theme
Created June 20, 2019 11:46
This script helps with testing pelican-themes.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# pick_random_theme - Thursday, June 20, 2019
""" This script will choose a random theme from pelican-themes and symlink it
in the project folder. Previously chosen themes are stored in TESTED_THEMES_FILENAME.
To loop through the themes again, delete TESTED_THEMES_FILENAME from disk or change
the filename.
Usage: pick_random_theme
@palevell
palevell / themes.py-sample.py
Created June 19, 2019 16:24
This is the list of pelican-themes at the time of this writing. To use it, place it in the same directory as your Pelican settings file (ie. `pelicanconf.py`) and rename it to `themes.py`.
# themes.py - Tuesday, June 18, 2019
""" This list is for testing pelican-themes """
Themes = [
'pelican-themes/smoothie', 'pelican-themes/water-iris',
'pelican-themes/voidy-bootstrap', 'pelican-themes/dev-random',
'pelican-themes/hyde', 'pelican-themes/lab',
'pelican-themes/Casper2Pelican', 'pelican-themes/basic',
'pelican-themes/dev-random2', 'pelican-themes/subtle',
'pelican-themes/Responsive-Pelican', 'pelican-themes/plumage',
@palevell
palevell / pelicanconf-themes.py
Last active January 15, 2022 21:07
This is an example Pelican config file for testing pelican-themes.Enjoy!
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
# 2019-Jun-19 PAL - This is for testing pelican-themes
from random import choice
import os, sys
sys.path.append(os.curdir)
# 2019-Jun-19 PAL - Load pelican-themes list (for testing)
from themes import Themes
@palevell
palevell / sql-ins-upd-ignore.py
Last active October 17, 2018 23:04
This code snippet demonstrate's SQLite's new UPSERT command.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# sql-ins-upd-ignore.py v1.0.0 - Tuesday, October 16, 2018
# Ref1: https://stackoverflow.com/a/50718957/2719754
# Ref2: https://www.sqlite.org/lang_UPSERT.html
"""
The UPSERT command is implemented by way of an ON CONFLICT clause
on the INSERT statement.
@palevell
palevell / t-clean.py
Last active October 9, 2017 15:34
Cleanup Twitter Followings with Ruby Gem 't' and Python's language detect module
#!/usr/bin/env python3
# t-clean.py v1.2.22 - Friday, September 15, 2017
# Cleanup Twitter Followings with Ruby Gem 't' and Python's language detect module
""""
Long Records (follow, unfollow, groupies, whoami, etc.)
0 ID
1 Since
2 Last tweeted at
3 Tweets
@palevell
palevell / edsh
Created August 10, 2017 15:10
Edit BASH shell script
#!/usr/bin/env bash
# edsh v1.4.27 - March 3, 2014
_me="${0##*/}"
# Test for file name
[[ $# -ne 1 ]] && { echo -en "Usage:\t$_me command_name\n"; exit 1; }
_file=~/bin/$1
# If needed, create a new command file
if [[ ! -e $_file ]]; then