Skip to content

Instantly share code, notes, and snippets.

@pourquoi
pourquoi / marshal.py
Last active May 30, 2019 21:37
sqlalchemy models prepartion for pydantic
import inspect
from typing import Union
from pydantic import BaseModel
from pydantic.fields import Field
from app.db.base_class import Base
def _get_field_model(field: Field):
"""
Returns the BaseModel of this field if it's associated to one.
@pourquoi
pourquoi / gist:d815836d593befecddf4
Created April 26, 2015 10:13
chrome socks proxy + dns
ssh -D 9999 root@REMOTE_IP
google-chrome --proxy-server="socks5://127.0.0.1:9999" --host-resolver-rules="MAP * 0.0.0.0 , EXCLUDE 127.0.0.1"
@pourquoi
pourquoi / gist:c79e1ab62856d3850ddc
Created April 26, 2015 10:11
jtr dynamic constant salted sha1
[List.Generic:dynamic_8180]
Expression=sha1($p.CONST1)
CONST1=mysaly
Flag=MGF_INPUT_20_BYTE
Flag=MGF_FLAT_BUFFERS
Func=DynamicFunc__clean_input_kwik
Func=DynamicFunc__append_keys
Func=DynamicFunc__append_input1_from_CONST1
Func=DynamicFunc__SHA1_crypt_input1_to_output1_FINAL
Test=$dynamic_8180$4f2c19f885eae0886b526fda968234874f51be34:mypassword
@pourquoi
pourquoi / gist:6f6c619500ca248640ee
Created July 1, 2014 11:52
doctrine extensions em.php reproducing bug #990
<?php
/**
* This entity manager configuration works with doctrine 2.1.x and 2.2.x
* versions. Regarding AnnotationDriver setup it most probably will be changed into
* xml. Because annotation driver fails to read other classes in same namespace
*/
// connection args, modify at will
$connection = array(
'host' => '127.0.0.1',
'port' => 3306,
@pourquoi
pourquoi / gist:dc716d021f1f5cf86577
Created July 1, 2014 11:51
doctrine extensions run.php reproducing bug #990
<?php
use Doctrine\ORM\Query;
use Gedmo\Translatable\TranslatableListener;
$executionStart = microtime(true);
$memoryStart = memory_get_usage(true);
$em = include 'em.php';