Skip to content

Instantly share code, notes, and snippets.

View carlosmr12's full-sized avatar

Carlos Rodrigues carlosmr12

  • Baker Heart and Diabetes Institute
  • Brisbane, Australia
  • X @carlosmr12
View GitHub Profile
@carlosmr12
carlosmr12 / mapping_colors.js
Created July 14, 2016 13:07
Mapping colors by chain for 3D visualization with 3Dmol.js
var color_mapping = function(chain){
var mapping = {
'A': '0xC0D0FF',
'B': '0xB0FFB0',
'C': '0xFFC0C8',
'D': '0xFFFF80',
'E': '0xFFC0FF',
'F': '0xB0F0F0',
'G': '0xFFD070',
'H': '0xF08080',
def perceptron_train(self, data):
errors = 0
w = list()
w.append([0 for item in range(0, len(data[0][1]))])
k = 0
all_correct = True
while(1):
all_correct = True
@carlosmr12
carlosmr12 / parserA1MachineLearning.py
Created April 9, 2016 22:01
Parser for A1 Machine Learning DCC831 01/206
from argparse import ArgumentParser
from collections import Counter
TRAIN_SET = str()
def main():
features_vector = list()
vocabulary_counter = Counter()
bag_words = set()
@carlosmr12
carlosmr12 / count_sublists_repetitions_in_list.py
Created November 11, 2015 23:04
Couting number of repetitions on a list of lists
list_int = [[1, 2, 3], [1, 2, 3], [1, 4, 5, 6], [10], [1, 2], [1, 2], [1, 2], [1, 2], [1, 4, 5, 6], [10], [1]]
list_int_aux = []
count = 0
for sublist in list_int:
if sublist not in list_int_aux and list_int.count(sublist) > 1:
count += 1
list_int_aux.append(sublist)
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
from Bio.PDB import PDBParser, PDBIO, Select
arquivos = [ f for f in os.listdir('.') if os.path.isfile(os.path.join('.',f)) ]
class ChainSelect(Select):
def __init__(self, chain):
[{ "team": "Boston Celtics" },{ "team": "Dallas Mavericks" },{ "team": "Brooklyn Nets" },{ "team": "Houston Rockets" },{ "team": "New York Knicks" },{ "team": "Memphis Grizzlies" },{ "team": "Philadelphia 76ers" },{ "team": "New Orleans Hornets" },{ "team": "Toronto Raptors" },{ "team": "San Antonio Spurs" },{ "team": "Chicago Bulls" },{ "team": "Denver Nuggets" },{ "team": "Cleveland Cavaliers" },{ "team": "Minnesota Timberwolves" },{ "team": "Detroit Pistons" },{ "team": "Portland Trail Blazers" },{ "team": "Indiana Pacers" },{ "team": "Oklahoma City Thunder" },{ "team": "Milwaukee Bucks" },{ "team": "Utah Jazz" },{ "team": "Atlanta Hawks" },{ "team": "Golden State Warriors" },{ "team": "Charlotte Bobcats" },{ "team": "Los Angeles Clippers" },{ "team": "Miami Heat" },{ "team": "Los Angeles Lakers" },{ "team": "Orlando Magic" },{ "team": "Phoenix Suns" },{ "team": "Washington Wizards" },{ "team": "Sacramento Kings" }]
[{ "team": "New Jersey Devils" },{ "team": "New York Islanders" },{ "team": "New York Rangers" },{ "team": "Philadelphia Flyers" },{ "team": "Pittsburgh Penguins" },{ "team": "Chicago Blackhawks" },{ "team": "Columbus Blue Jackets" },{ "team": "Detroit Red Wings" },{ "team": "Nashville Predators" },{ "team": "St. Louis Blues" },{ "team": "Boston Bruins" },{ "team": "Buffalo Sabres" },{ "team": "Montreal Canadiens" },{ "team": "Ottawa Senators" },{ "team": "Toronto Maple Leafs" },{ "team": "Calgary Flames" },{ "team": "Colorado Avalanche" },{ "team": "Edmonton Oilers" },{ "team": "Minnesota Wild" },{ "team": "Vancouver Canucks" },{ "team": "Carolina Hurricanes" },{ "team": "Florida Panthers" },{ "team": "Tampa Bay Lightning" },{ "team": "Washington Capitals" },{ "team": "Winnipeg Jets" },{ "team": "Anaheim Ducks" },{ "team": "Dallas Stars" },{ "team": "Los Angeles Kings" },{ "team": "Phoenix Coyotes" },{ "team": "San Jose Sharks" }]
<style type="text/css">
.cal_Theme1 .ajax__calendar_container
{
background-color: #e2e2e2;
border: solid 1px #cccccc;
}
.cal_Theme1 .ajax__calendar_header
{
background-color: #ffffff;
margin-bottom: 4px;
@carlosmr12
carlosmr12 / gmail_access
Created March 8, 2012 19:59
access link inside gmail
assert world.aux.find_link_by_text('perfect/index.php/publiccastings/')
answer_url = world.aux.find_link_by_partial_text('perfect/index.php/publiccastings')
time.sleep(2)
world.aux.quit()
time.sleep(1.5)
world.aux1 = Browser('chrome')
world.aux1.visit(answer_url)
assert True
@carlosmr12
carlosmr12 / set_check_mann
Created March 2, 2012 16:23
setting mannequins and checking them
#################### SET MANNEQUINS #########################
@step(u'E devo selecionar alguns modelos para este evento')
def e_devo_selecionar_alguns_modelos_para_este_evento(step):
assert world.browser.find_by_css('a.btn_on_footer')
world.browser.find_by_css('a.btn_on_footer').click()
select_models('carlos')
def select_models(x):
world.browser.execute_script('$("iframe:last").attr("id","iframeModelsSelect")')
with world.browser.get_iframe("iframeModelsSelect") as iframe: