Skip to content

Instantly share code, notes, and snippets.

Peter Molnar petermolnar

View GitHub Profile
@petermolnar
petermolnar / facebook2wordpress.py
Last active Feb 22, 2019
facebook json export to wp-cli import bash
View facebook2wordpress.py
import json
import arrow
import os
import logging
from shlex import quote
from pprint import pprint
base = '/web/blog.pakuauk.com/exports/facebook-export'
with open('facebook-export/posts/posts.json', 'rt') as f:
@petermolnar
petermolnar / themeswitcher.css
Created Jan 10, 2019
automatic (prefers-color-scheme) and manual CSS theme switcher with vanilla javascript snippet
View themeswitcher.css
.theme input + label {
border-bottom: 3px solid transparent;
}
.theme input:checked + label {
border-bottom: 3px solid #ccc;
}
.theme,
.theme input {
View backup-github.sh
#!/usr/bin/env bash
function usage () {
echo "backup-github.sh
A tiny bash script to backup own and starred public github repositories
Usage:
backup-github.sh GITHUB_USERNAME DIRECTORY_TO_BACKUP_TO"
exit 1
@petermolnar
petermolnar / logs2pidgin.py
Last active Mar 4, 2018
Python script to convert varios logs (MSN Plus!, Skype v2, Trillian v3, etc) to Pidgin
View logs2pidgin.py
import os
import sqlite3
import logging
import re
import glob
import sys
import hashlib
import arrow
import argparse
from bs4 import BeautifulSoup
@petermolnar
petermolnar / unfix-all-the-toolbars.user.js
Last active Sep 6, 2018 — forked from vbuaraujo/unfix-all-the-toolbars.user.js
GreaseMonkey script to remove "position: fixed" from webpages
View unfix-all-the-toolbars.user.js
// ==UserScript==
// @name unfix-all-the-toolbars
// @description Removes "position: fixed" style from elements, unfixing "toolbars" and the such.
// @namespace http://inf.ufrgs.br/~vbuaraujo/
// @include *
// @version 1.2
// @grant none
// ==/UserScript==
@petermolnar
petermolnar / wp-cron
Last active Jan 5, 2018
cron file for wordpress backup and wp-cron using wp-cli
View wp-cron
MAILTO="you@domain.com"
SHELL=/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
# prerequisities:
# sudo wget -q -O/usr/local/bin/wpcli https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar; sudo chmod 0755 /usr/local/bin/wpcli
# WP CRON
* * * * * wpuser cd /path/to/wordpress; wpcli cron event run --due-now --quiet
You can’t perform that action at this time.