Skip to content

Instantly share code, notes, and snippets.

View fdobrovolny's full-sized avatar

Filip Dobrovolný fdobrovolny

View GitHub Profile
@fdobrovolny
fdobrovolny / upload.py
Created March 25, 2021 15:29
Command line utility to generate curl commands with presigned AWS S3 upload POST URLs
#!/usr/bin/env python
"""
This command line utility enables you to easily create presigned
urls for uploading files. This can be usdeful for running on
remote machines without risking to copy over your credentials.
Filip Dobrovolny <[email protected]> 2020
"""
@fdobrovolny
fdobrovolny / gist:66068fbbcacff1a748b98fb59dcad826
Created December 1, 2019 00:37
Ghost 502 image upload STRACE
epoll_pwait(3, [{EPOLLIN, {u32=21, u64=21}}], 1024, 1000, NULL, 8) = 1
accept4(21, NULL, NULL, SOCK_CLOEXEC|SOCK_NONBLOCK) = 22
mprotect(0x9e021c04000, 503808, PROT_READ|PROT_WRITE) = 0
mprotect(0x9e021c84000, 503808, PROT_READ|PROT_WRITE) = 0
mprotect(0x9e021e84000, 503808, PROT_READ|PROT_WRITE) = 0
mprotect(0x9e021f04000, 503808, PROT_READ|PROT_WRITE) = 0
mprotect(0x9e021f84000, 503808, PROT_READ|PROT_WRITE) = 0
mprotect(0x9e021e04000, 86016, PROT_READ|PROT_WRITE) = 0
mprotect(0x9e021d84000, 86016, PROT_READ|PROT_WRITE) = 0
mprotect(0x9e021d04000, 86016, PROT_READ|PROT_WRITE) = 0
@fdobrovolny
fdobrovolny / fortuna.xml
Last active May 9, 2019 22:27
Match example
<Match Id="21489630" Name="Liverpool - Tottenham" MatchDate="2019-06-01T21:00:00" HasLiveMatch="false" HasVideoStream="false">
<Teams>
<Team Id="4324" Name="Liverpool"/>
<Team Id="115375" Name="Tottenham"/>
</Teams>
<Bets>
<Bet Id="21489630" Info="307" TypeId="1" Name="Zápas" Note="finále / Madrid">
<Odds Id="68525071" Name="1">1.98</Odds>
<Odds Id="68525072" Name="0">3.6</Odds>
<Odds Id="68525073" Name="2">4.05</Odds>
@fdobrovolny
fdobrovolny / filter.py
Last active October 31, 2019 08:39
Pass multiple parametrs into Django filter
"""Pass multiple parametrs into Django filter.
Inspired by http://stackoverflow.com/a/24402622/2629036.
By this filters you can chain as many variables into parametrs as you like.
You can even make different lengths for one filter.
WARNING: You have to apply n_chain_end filter at the end of the n_chains.
Thanks to this the intial var can also be tupple.
@fdobrovolny
fdobrovolny / settings.py
Created January 5, 2017 21:29
Django get settings in template
import re
from django import template
from django.conf import settings
register = template.Library()
ALLOWABLE_VALUES = ("CONSTANT_NAME_1", "CONSTANT_NAME_2", "template_\w*")