Skip to content

Instantly share code, notes, and snippets.

View Geekfish's full-sized avatar
🐝
... 🐝 ... 🐝 ... 🐝 ... 🐝

Eleni Lixourioti Geekfish

🐝
... 🐝 ... 🐝 ... 🐝 ... 🐝
View GitHub Profile
@Geekfish
Geekfish / bookingmood_embed.html
Last active October 24, 2022 17:54
Wordpress Fixes
<p></p><script src="https://www.bookingmood.com/js/embed.js"></script>
<div data-bm="calendar/<REPLACE-WITH-CALENDAR-ID>" data-bm-layout="popup" data-bm-label="Έλεγχος διαθεσιμότητας" data-bm-background-color="#2563eb" data-bm-color="#fff" data-bm-width="#50" class="wp-bookingmood-widget"></div>
@Geekfish
Geekfish / formatters.ex
Created August 11, 2022 12:38
ExMachina Formatters
defmodule ExMachina.Sequence.Formatters do
@moduledoc false
@latin_letters 26
@codepoint_start 65
@spec to_alpha_code(integer(), integer()) :: String.t()
@doc """
Converts an integer (like a sequence counter) to an n-letter uppercase code.
Examples:
@Geekfish
Geekfish / bookmarklet.js
Created October 27, 2020 19:43
Bookmarklet | Seedlang | Retire Review
javascript:(function(){document.getElementsByClassName("graph-outline-icon icon")[0].parentElement.parentElement.parentElement.click(); Array.from(document.getElementsByTagName("button")).forEach(function(button) {if(button.innerText == "Retire Review") { button.click();}});})();
@Geekfish
Geekfish / Leo-Anki.js
Last active February 8, 2019 19:45 — forked from fbecart/Leo-Anki.js
Bookmarklet to export Leo Trainer words to an Anki deck.
/**
* This bookmarklet makes it possible to transfer words from Leo Trainer to Anki.
* It only works for fr-de translations. Contact me for other languages.
*
* Prerequisites:
* - a Leo account (http://www.leo.org/) with a few words saved in the trainer
* - an Anki account (https://ankiweb.net/account/register)
*
* 1. Crunch the following code and add it to your bookmarks http://ted.mielczarek.org/code/mozilla/bookmarklet.html
* 2. Run the bookmarklet on this page https://dict.leo.org/trainer/manageFolder.php?lp=frde&lang=de
@Geekfish
Geekfish / cli.py
Last active January 27, 2019 11:56
Straight into the interpreter, vs in function
$ python3
Python 3.7.0 (default, Jul 23 2018, 20:24:19)
[Clang 9.0.0 (clang-900.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> class C():
... def __init__(self, i):
... print(f"contructing {i}")
... self.i = i
... def __del__(self):
... print(f"deleting {self.i}")
@Geekfish
Geekfish / inspect_mounts.sh
Last active January 2, 2019 15:12
Inspect mounted volumes in docker containers
docker ps -q | xargs -I '{}' docker inspect {} | jq '.[] | {container_id: .Id, image: .Config.Image, mounts: .Mounts}'
@Geekfish
Geekfish / comma_comma_and.py
Created August 20, 2018 14:09
Comma Comma And
def comma_comma_and(_list, conj=u"and"):
"""
Accepts a list of strings and returns a single string, stitching it all
together.
Eg:
comma_comma_and(["Papa Bear", "Mama Bear", "Baby Bear"])
# > "Papa Bear, Mama Bear, and Baby Bear"
comma_comma_and(["Chocolate", "cake", "ice-cream"], conj="or")
@Geekfish
Geekfish / README.md
Last active December 12, 2018 10:49
Ticket in commit msg (Github and CodebaseHQ versions)

This is a hook that adds the ticket number to the commit message, if it can be infered by the branch name. (ex. branch name bugfix/5234-fix-a-thing would result in #5234 for the github version or [t: 5234] for the codebase version.

@Geekfish
Geekfish / useful_commands.md
Last active May 1, 2018 14:37
Useful commands

Show the SQL executed by a migration:

python manage.py sqlmigrate <appname> <migration no eg. 0001 or 0004>

Generate a signing key:

import random, string
@Geekfish
Geekfish / patch_with_reload.py
Last active July 27, 2023 08:44
Same as patch, but allows you to pass a module object which will be reloaded when entering/leaving the context.
import imp
from functools import partial
from mock.mock import _patch, _get_target, DEFAULT
class PatchWithReload(_patch):
def __init__(self, module_to_reload, *args, **kwargs):
self.module_to_reload = module_to_reload
super(PatchWithReload, self).__init__(*args, **kwargs)