Skip to content

Instantly share code, notes, and snippets.

View ewjoachim's full-sized avatar
🐍
👨‍💻

Joachim Jablon ewjoachim

🐍
👨‍💻
View GitHub Profile
@ewjoachim
ewjoachim / console_output
Created December 29, 2019 19:55
Poetry optimisation
╭ ➜ joachim@picaboo.home:~/code/poetry git:‹master› ✗
╰ ➤ poetry cache clear --all pypi
Delete 354 entries? (yes/no) [no] y
╭ ➜ joachim@picaboo.home:~/code/poetry git:‹master› ✗
╰ ➤ poetry run poetry update -vvv
Using virtualenv: /Users/joachim/Library/Caches/pypoetry/virtualenvs/poetry-_7w_5daP-py3.7
Updating dependencies
Resolving dependencies...
1: fact: poetry is 1.0.0
1: derived: poetry
@ewjoachim
ewjoachim / discussion.md
Last active July 9, 2019 09:11
Automating a Python package release

Disclaimer

TL;DR: please don't spend your voluteer time helping me solve problems I'll get paid for, if you don't want the answer too.

While I'm interested in solving these questions for open source packages, the open source package I personally maintain don't have this much traction that I can't do it by myself. I'm also interested in this to solve problems I have at work, and it's disloyal to crowdsource ideas for problems I have in closed-source projects without explicitely stating so. So here I am, stating that whatever comes out of this may benefit my closed source projects maybe more

@ewjoachim
ewjoachim / keybase.md
Created May 10, 2019 21:11
Keybase verification (again)

Keybase proof

I hereby claim:

  • I am ewjoachim on github.
  • I am ewjoachim (https://keybase.io/ewjoachim) on keybase.
  • I have a public key ASBTTp8ajCLMNdaeO6RjhhT8wBZ5CrDEFSpOO-1DnLRxpgo

To claim this, I am signing this object:

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import sys
import os
import logging
import logging.handlers
STR_FMT = '%(asctime)s - %(name)-8s - %(levelname)-9s - %(funcName)-15s - %(message)s'
DATE_FMT = '%d-%m-%Y %H:%M:%S'
import collections
@ewjoachim
ewjoachim / i18n.py
Last active October 31, 2017 08:24
Django, gettext, contexts and comments
from django.utils.translation import ugettext as _
from django.utils.translation import pgettext
# _() means normal translation
_("Hello world")
# Translators: This is a comment
_("Hello world")
@ewjoachim
ewjoachim / models.singer-part.js
Last active July 30, 2017 16:33
Ember inspector 100% cpu
import DS from 'ember-data';
export default DS.Model.extend({
songPart: DS.belongsTo('song-part'),
singer: DS.belongsTo('singer'),
});
@ewjoachim
ewjoachim / stop-old-containers.sh
Created June 1, 2017 13:27
Stop docker containers older than 1 day old
#!/bin/bash -eux
yesterday=$(date -d yesterday +%s)
# dnsdock should not be stopped : we limit to the containers created after it
docker ps --filter since=dnsdock -q --format "{{.ID}} {{.CreatedAt}}" | while read line
do
# line looks like:
# 123456789abcdef 2017-01-01 00:00:00 +02:00 CEST
set $line
id=$1
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ewjoachim
ewjoachim / clmystery.py
Last active November 25, 2021 22:35
CLMystery as a python "one-liner" (well, one expression)
"Yay" if __import__("hashlib").md5((next((n & g).pop() for g, n in
(
(g, set(dr["Owner"] for dr in v if all(el in t.lower().split() for el in
[
dr["Color"].lower(), dr["Make"].lower(),
dr["Height"].split("'")[0] + "'",
]) and
dr["License Plate"].startswith(__import__("re")
.search(r'starts with "([A-Z0-9]+)"', t).group(1)) and
dr["License Plate"].endswith(__import__("re")