Skip to content

Instantly share code, notes, and snippets.

View apie's full-sized avatar

Denick apie

View GitHub Profile
#!/usr/bin/env python3
import ast
import sys
import re
from os.path import splitext
'''
By Denick. 20241003.
Parse a text file containing a printed python dict with data and try to construct a TypedDict definition. Only works for basic data types in the dict, so fe. datetime type will not work and has to be added manually to your class definition later.'''
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@apie
apie / scrape_ratings.py
Last active March 8, 2021 22:12
scrape imdb ratings
#!/usr/bin/env python3
#By Apie, 2021-03-08
import sys
from lxml import html
import requests
BASE_URL = 'https://www.imdb.com'
assert len(sys.argv) > 1, 'provide ratings page url'
url = sys.argv[1]
@apie
apie / advent.cron
Created December 2, 2020 20:54
Advent cron: send a line from a file every day of december until Christmas.
0 8 1-24 12 * sed -n $(/bin/date +\%d)p /home/santa/presents.txt | mail user
@apie
apie / list_screen.bash
Last active December 2, 2020 20:49
Asks to attach screen, only if we are not already in a screen session.
#!/bin/bash
screen -list
if [ $? -eq 0 ] && [ -z "$STY" ]
then
echo -n "Attach screen session? (Y/n)"
read answer
if [ "$answer" == "" ] || [ "$answer" != "${answer#[Yy]}" ] ;then
screen -UraAd
fi
# Format items in an RSS feed for use in an IRC channel topic. E.g:
# ma 18jun Hackatrain| ma 18jun UT Educational Award Ceremony| wo 20jun Lunchlezing Ricardo Rail
#
# Author: Apie
# Licence: MIT
use strict;
use warnings;
use 5.010;
use XML::FeedPP;
#!/usr/bin/env python3
# Format items in an RSS feed for use in an IRC channel topic. E.g:
# ma 18jun Hackatrain| ma 18jun UT Educational Award Ceremony| wo 20jun Lunchlezing Ricardo Rail
#
# Licence: MIT
import re
import datetime
from rss_parse import RSSParser
from dateutil.parser import parse
#!/bin/bash
# Licence: MIT
# Uitvoer van commando 'http' alleen tonen bij successvolle exitcode.
# Consequentie is dat het request 2x gedaan moet worden, want opslaan in bash breekt alle kleuren etc.
# Retourneert originele exitcode.
if [ "$1" != "http" ]
then
echo "Alleen geschikt voor het commando 'http'."
exit 1
// ==UserScript==
// @name Tubantia scroll to top
// @version 1
// @include https://www.tubantia.nl/*
// @include https://www.gelderlander.nl/*
// @include https://www.bd.nl/*
// @include https://www.ad.nl/*
// @description If you browse Tubantia without javascript, each page will be scrolled to the bottom.. Use this script to fix that.
// @grant none
// @namespace https://greasyfork.org/users/8309