Skip to content

Instantly share code, notes, and snippets.

View carlos-aguayo's full-sized avatar

Carlos Aguayo carlos-aguayo

View GitHub Profile
<replace-with class="com.dreamskiale.client.history.Html5Historian">
<when-type-is class="com.google.gwt.place.shared.PlaceHistoryHandler.DefaultHistorian"/>
<any>
<when-property-is name="user.agent" value="gecko1_8"/>
<when-property-is name="user.agent" value="safari"/>
<when-property-is name="user.agent" value="opera"/>
</any>
</replace-with>
<replace-with class="com.dreamskiale.client.history.HashBangHistorian">
<when-type-is class="com.google.gwt.place.shared.PlaceHistoryHandler.DefaultHistorian"/>
private native void pushState(String url) /*-{
url += $wnd.location.search;
$wnd.history.pushState(null, $doc.title, url);
}-*/;
private native void replaceState(String url) /*-{
url += $wnd.location.search;
$wnd.history.replaceState(null, $doc.title, url);
}-*/;
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<p>hello world</p>
</body>
</html>
@carlos-aguayo
carlos-aguayo / removedups.py
Last active August 29, 2015 14:03
Python - Remove duplicated files
import os, hashlib
from os import listdir
from os.path import isfile, join
mypath = "."
files = [ f for f in listdir(mypath) if isfile(join(mypath,f)) ]
hashes = set()
@carlos-aguayo
carlos-aguayo / gist:5bd33f0c5007acb0de7f
Created January 17, 2015 23:49
Turing machine, single head, single tape
######################################################################
# Task: Describe a Turing machine that shifts the input string one
# space to the right and places the symbol ($) in the first location
# on the tape.
######################################################################
# Enter values below for
# q_0 : the initial state (an int)
# q_a : the accept state (an int)
# q_r : the reject state (an int)
# delta : the transition function expressed as a dictionary
@carlos-aguayo
carlos-aguayo / CartPole-v0.py
Last active April 7, 2021 03:30
OpenAI Gym CartPole-v0
import gym
import pandas as pd
import numpy as np
import random
# https://gym.openai.com/envs/CartPole-v0
# Carlos Aguayo - carlos.aguayo@gmail.com
class QLearner(object):
@carlos-aguayo
carlos-aguayo / voicegender.py
Created July 19, 2017 22:07
Comparison for XGBoost, LightGBM and a Neural Network
import pandas as pd
from xgboost import XGBClassifier
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
from sklearn.preprocessing import LabelEncoder
dataset = pd.read_csv('https://github.com/primaryobjects/voice-gender/raw/master/voice.csv', header=0).values
x = dataset[:, :-1]
y = dataset[:, -1]
@carlos-aguayo
carlos-aguayo / jira.py
Last active July 26, 2017 02:30
Get an Excel report on the number of comments in JIRA tickets
from jira import JIRA
from dateutil.parser import parse
import pandas as pd
# For any ticket that was externally reported or labeled a hotfix in the last 90 days, compute:
# 1. Number of comments
# 2. How long it took for it to be labeled hotfix
# 3. Number of transitions across squads
username = 'carlos.aguayo'
@carlos-aguayo
carlos-aguayo / screenshot.py
Created February 19, 2018 21:19
Given a filename, find all http links and take a screenshot of them.
from selenium import webdriver
from BeautifulSoup import BeautifulSoup
import requests
options = webdriver.ChromeOptions()
options.add_argument('headless')
driver = webdriver.Chrome(chrome_options=options)
driver.set_window_size(1280, 1600)
filename = 'NOTICE.html'
@carlos-aguayo
carlos-aguayo / gist:5402e0a59117b70227ecdfa3bebeb4c9
Created February 22, 2018 04:16
Inception-V3 Model Summary
__________________________________________________________________________________________________
Layer (type) Output Shape Param # Connected to
==================================================================================================
input_1 (InputLayer) (None, None, None, 3 0
__________________________________________________________________________________________________
conv2d_1 (Conv2D) (None, None, None, 3 864 input_1[0][0]
__________________________________________________________________________________________________
batch_normalization_1 (BatchNor (None, None, None, 3 96 conv2d_1[0][0]
__________________________________________________________________________________________________
activation_1 (Activation) (None, None, None, 3 0 batch_normalization_1[0][0]