Skip to content

Instantly share code, notes, and snippets.

View aj07mm's full-sized avatar

Julio Marins aj07mm

View GitHub Profile
@aj07mm
aj07mm / pagespeed_response.txt
Created June 6, 2019 17:25
pagespeed_response.txt
(Pdb) response.keys()
[u'kind', u'captchaResult', u'formattedResults', u'title', u'ruleGroups', u'version', u'responseCode', u'pageStats', u'id']
(Pdb) response['kind']
u'pagespeedonline#result'
(Pdb) response['captchaResult']
u'CAPTCHA_NOT_NEEDED'
(Pdb) response['title']
u'Kinnek | Helping businesses share reputation information'
(Pdb) response['ruleGroups']
{u'SPEED': {u'score': 75}}
@aj07mm
aj07mm / build_dojotimer.txt
Created June 4, 2019 13:24
build_dojotimer.txt
Kali
apt-get install mono-complete
xbuild scallion.sln /p:TargetFrameworkVersion="v4.5"
@aj07mm
aj07mm / gist:15cb83ac62b7bc6771b28895cd2a2226
Created March 28, 2019 00:22 — forked from pazdera/gist:1098129
Singleton example in Python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Example of Singleton design pattern
# Copyright (C) 2011 Radek Pazdera
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
@aj07mm
aj07mm / log.py
Created January 25, 2019 17:28
log.py
import sys
import logging
logger = logging.getLogger('kinnek')
logger.setLevel(logging.DEBUG)
handler = logging.StreamHandler(sys.stdout)
handler.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
handler.setFormatter(formatter)
@aj07mm
aj07mm / requests-oauth2.py
Created January 15, 2019 20:45 — forked from ymotongpoo/requests-oauth2.py
Google API OAuth 2.0 Authorization Sample in Python
# -*- coding: utf-8 -*-
"""
This scripts reqire a third party module 'requests'.
You can get it from PyPI, i.e. you can install it using
easy_install or pip.
http://docs.python-requests.org/en/v0.10.4/
Original source code is written by shin1ogawa, which is in Java.
@aj07mm
aj07mm / solid.md
Last active December 21, 2018 16:05
solid.md

Liskov Substitution Principle

if S is a subtype of T, then objects of type T may be replaced with objects of type S (i.e. an object of type T may be substituted with any object of a subtype S) without altering any of the desirable properties of the program

  • Method parameter types are contravariant, i.e. if you override a method, the overriding method in the subtype must accept parameters of the same types or more general types as the overridden method.
  • Method return types are covariant, i.e. the overriding method in a subtype must return the same type or a more specific type as the overridden method.
  • Methods in subtypes must not raise any new exceptions that are not only raised by the overridden method in the supertype, except for exceptions whose types are themselves subtypes of the exceptions raised by the overridden method.
  • Preconditions cannot be strengthened in a subtype, i.e. if you replace an object with a subtype, you cannot impose additional restrictions on the caller, since the
@aj07mm
aj07mm / aws.md
Last active February 20, 2019 15:59
aws.md

Region > AZ


Cloudfront

 User <--(edge location)--> origin(__s3__, __ec2__, elb, route53)
              ^
 |

Configuring Nginx to serve SSL content is straight forward, once you have your certificate and key ready:

server { 
    listen 443 default ssl;
    root /path/to/source;
    server_name mydomain;

    ssl_certificate      /path/to/cert;
    ssl_certificate_key  /path/to/key;
@aj07mm
aj07mm / logging_levels.md
Created November 27, 2018 16:42
logging_levels.md
Logging Levels
The numeric values of logging levels are given in the following table. These are primarily of interest if you want to define your own levels, and need them to have specific values relative to the predefined levels. If you define a level with the same numeric value, it overwrites the predefined value; the predefined name is lost.

Level	Numeric value
CRITICAL	50
ERROR	40
WARNING	30
INFO	20
DEBUG	10
@aj07mm
aj07mm / search-replace.sh
Created October 25, 2018 15:00
search-replace.sh
grep -rl WeightSortingStrategy . | xargs sed -i 's/WeightSortingStrategy/CompanySortingStrategy/g'