Skip to content

Instantly share code, notes, and snippets.

View ricoms's full-sized avatar
🐍

Ricardo Savii ricoms

🐍
View GitHub Profile
@mateusmaaia
mateusmaaia / dafiti-products.js
Last active November 17, 2019 15:15
Discover what products are sold and distributed by Dafiti's
javascript:(
function(){
$(".banner-text-box").css("display", "none");
$(".col-md-3").css("width","15%");
$(".col-md-9").css("width","85%");
$(".product-list-col-3 .product-box").css({"width": "30%", "margin-right": "3%"});
$(".product-box").each((i, item) => {
url = $(item).find(".quickview-link.product-box-preview").attr("data-remote");
@fuatbeser
fuatbeser / tensorboard_in_colab.py
Created August 19, 2018 10:53
Run Tensorboard in Google Colab
# You can change the directory name
LOG_DIR = 'tb_logs'
!wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip
!unzip ngrok-stable-linux-amd64.zip
import os
if not os.path.exists(LOG_DIR):
os.makedirs(LOG_DIR)
@nmwalsh
nmwalsh / falcon_gateway.py
Created December 7, 2017 02:23
Falcon API gateway for a simple machine learning API
# falcon_gateway.py
import falcon
import json
from data_handler import invoke_predict
# Falcon follows the REST architectural style, meaning (among
# other things) that you think in terms of resources and state
# transitions, which map to HTTP verbs.
@cbaziotis
cbaziotis / AttentionWithContext.py
Last active April 25, 2022 14:37
Keras Layer that implements an Attention mechanism, with a context/query vector, for temporal data. Supports Masking. Follows the work of Yang et al. [https://www.cs.cmu.edu/~diyiy/docs/naacl16.pdf] "Hierarchical Attention Networks for Document Classification"
def dot_product(x, kernel):
"""
Wrapper for dot product operation, in order to be compatible with both
Theano and Tensorflow
Args:
x (): input
kernel (): weights
Returns:
"""
if K.backend() == 'tensorflow':
@BrunoGrandePhD
BrunoGrandePhD / remove-big-file.sh
Created December 15, 2016 01:16
Remove a large committed file from your Git repository.
# The commands below are a guide to remove a large file that has been
# accidentally committed to a Git repository's history. If the file is
# larger than 100 MB, GitHub will prevent you from pushing your latest
# commits. The annotated steps below should help you remove the large
# file from your commit history, even if you've made new commit since.
# Some Git users advise against rebasing. You can safely use it here
# because you haven't published your changes yet.
# So, you first need to rebase your current branch onto the point that
@marcoscastro
marcoscastro / kosaraju.cpp
Created October 25, 2015 17:35
C++ - Algoritmo de Kosaraju
/*
Implementação do algoritmo de Kosaraju
Detecta componentes fortemente conectadas
*/
#include <iostream>
#include <stack>
#include <list>
using namespace std;
@developius
developius / README.md
Last active April 25, 2024 22:15
Setup SSH keys for use with GitHub/GitLab/BitBucket etc

Create a new repository, or reuse an existing one.

Generate a new SSH key:

ssh-keygen -t rsa -C "your_email@example.com"

Copy the contents of the file ~/.ssh/id_rsa.pub to your SSH keys in your GitHub account settings (https://github.com/settings/keys).

Test SSH key:

@pkuczynski
pkuczynski / parse_yaml.sh
Last active April 9, 2024 18:36
Read YAML file from Bash script
#!/bin/sh
parse_yaml() {
local prefix=$2
local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034')
sed -ne "s|^\($s\)\($w\)$s:$s\"\(.*\)\"$s\$|\1$fs\2$fs\3|p" \
-e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 |
awk -F$fs '{
indent = length($1)/2;
vname[indent] = $2;
for (i in vname) {if (i > indent) {delete vname[i]}}