Skip to content

Instantly share code, notes, and snippets.

View cristianmiranda's full-sized avatar
🏡
Working from home

Cristian Miranda cristianmiranda

🏡
Working from home
View GitHub Profile
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
@cristianmiranda
cristianmiranda / Proxies.md
Last active July 3, 2017 15:19
Proxies.md

Proxies

If you specify a proxy option, then the request (and any subsequent redirects) will be sent via a connection to the proxy server. Si especificas una opcin de proxy, entonces el request (y cualquier otro redirect subsecuente) será enviado a través de una conexin al servidor proxy.

If your endpoint is an https url, and you are using a proxy, then request will send a CONNECT request to the proxy server first, and then use the supplied connection to connect to the endpoint. Si tu endpoint es una url con https, y ests usando un proxy, entonces el request enviará un CONNECT request al servidor proxy primero, y luego usará la conexión provista para conectarse al endpoint

That is, first it will make a request like:

import os
import sys
import PyPDF2 as pyPdf
def arabic_to_roman(arabic):
roman = ''
while arabic >= 1000:
roman += 'm'
@cristianmiranda
cristianmiranda / indicators_matcher.py
Last active April 28, 2017 16:07
Custom Indicators matcher
import csv
import psycopg2
from difflib import SequenceMatcher
from tabulate import tabulate
MIN_SIMILARITY_RATIO = 0.8
# LOCAL
PSQL_HOST = 'localhost'
@cristianmiranda
cristianmiranda / lifx_speech.py
Last active July 22, 2016 13:27
lifx_speech.py
# NOTE: this example requires PyAudio because it uses the Microphone class
import time
import requests
import speech_recognition as sr
'''
LIFX API methods
'''
#!/usr/bin/python
# open a microphone in pyAudio and listen for taps
# brew install portaudio
# pip install --allow-external pyaudio --allow-unverified pyaudio pyaudio
import pyaudio
import struct
import math
/*
Button
Turns on and off a light emitting diode(LED) connected to digital
pin 13, when pressing a pushbutton attached to pin 2.
The circuit:
* LED attached from pin 13 to ground
* pushbutton attached to pin 2 from +5V
@cristianmiranda
cristianmiranda / crossbrowser.css
Created January 13, 2016 17:00
Specific Browser CSS
/* Google Chrome (version 28+): */
@supports (-webkit-appearance:none) {
nav.tm_navbar {
background: green;
}
}
/* Mozilla Firefox (all versions): */
_:-moz-tree-row(hover), nav.tm_navbar {
background: red;
@cristianmiranda
cristianmiranda / log4j.properties
Created December 29, 2015 16:09
Shiro - log4j.properties
log4j.appender.SHIRO=org.apache.log4j.ConsoleAppender
log4j.appender.SHIRO.target=System.out
log4j.appender.SHIRO.layout=org.apache.log4j.PatternLayout
log4j.appender.SHIRO.layout.ConversionPattern=%p [%c{1}] %m%n
log4j.additivity.org.apache.shiro=false
log4j.appender.mainlogger=org.apache.log4j.ConsoleAppender
log4j.appender.mainlogger.target=System.out
log4j.appender.mainlogger.layout=org.apache.log4j.PatternLayout
@cristianmiranda
cristianmiranda / FhirServiceTest.java
Last active October 22, 2015 00:36
Mocking static classes
@RunWith(PowerMockRunner.class)
@PrepareForTest(JS.class)
public class FhirServiceTest {
private FhirService service;
@Before
public void setup() {
GWTMockUtilities.disarm();
this.service = new FhirServiceImpl();