Skip to content

Instantly share code, notes, and snippets.

View FinnWoelm's full-sized avatar

Finn Woelm FinnWoelm

View GitHub Profile
@FinnWoelm
FinnWoelm / README.md
Last active September 3, 2024 03:34
Docs for yoyo-migrations (v8.2.0)
@FinnWoelm
FinnWoelm / Task.py
Last active April 4, 2024 15:04
PostgreSQL Task Queue (with SQLAlchemy)
import datetime
from sqlalchemy import Column, Integer, String, DateTime
from sqlalchemy import not_, exists, alias, select
from sqlalchemy.ext.hybrid import hybrid_property
import models
class Task(models.BaseModel):
id = Column(Integer, primary_key=True)
# Domain name of the website
@FinnWoelm
FinnWoelm / read-text-message.sh
Created December 27, 2019 14:01
How to read text messages from USB modem
# Full instructions: http://manpages.ubuntu.com/manpages/bionic/en/man8/mmcli.8.html
# Examples: http://manpages.ubuntu.com/manpages/bionic/en/man8/mmcli.8.html#examples
# Supported modems: https://www.freedesktop.org/wiki/Software/ModemManager/SupportedDevices/
# Get list of connected modems.
mmcli --list-modems
# Output:
# Found 1 modems:
# /org/freedesktop/ModemManager1/Modem/1 [huawei] E3531
# The number at the end of the path is the modem index.
@FinnWoelm
FinnWoelm / puma.service
Last active November 26, 2021 09:23 — forked from arteezy/puma.service
Manage Puma with systemd on Ubuntu 16.04 and rvm
[Unit]
Description=Puma Rails Server
After=network.target
[Service]
Type=simple
User=deploy
WorkingDirectory=/var/apps/upshift/current
ExecStart=/usr/local/rvm/bin/rbenv default do bundle exec pumactl -S /var/apps/upshift/shared/tmp/pids/puma.state -F /var/apps/upshift/shared/puma.rb start
ExecStop=/usr/local/rvm/bin/rbenv default do bundle exec pumactl -S /var/apps/upshift/shared/tmp/pids/puma.state -F /var/apps/upshift/shared/puma.rb stop
@FinnWoelm
FinnWoelm / repeated_feature_test.rb
Last active July 14, 2017 11:11
Run (a) cucumber feature test(s) repeatedly and count successes and failures
#!/usr/bin/env ruby
#
# USAGE:
# $ ./repeated_feature_test.rb n test
# n: number of times to run the test
# test: the test you would like to run, such as "cucumber" or
# "cucumber features/posts.feature --format progress"
#
# Due to the nature of executing commands, you will not see output until the end
# of each test round. For example, if you set "cucumber" as the task, you will
@FinnWoelm
FinnWoelm / functions.php
Last active August 1, 2016 20:08
Adding button to Wordpress TinyMCE Editor via Theme Files
<?php
// functions.php
// ...
// add new buttons
add_filter( 'mce_buttons', 'myplugin_register_buttons' );
function myplugin_register_buttons( $buttons ) {
array_push( $buttons, '|', 'custom_class');