Skip to content

Instantly share code, notes, and snippets.

View balkian's full-sized avatar

J. Fernando Sánchez balkian

View GitHub Profile
def latex_max(data, bgcolor='yellow', fgcolor="black", ignore=['AvgContent',]):
'''
highlight the maximum in a Series or DataFrame
'''
txt = '{:.3f}'
attr = '\textbf{{{}}}'
attr_max = '\colorbox{{' + bgcolor + '}}{{\textcolor{{' + fgcolor + '}}{{{}}}}}'
# print(data)
is_max = data >= data.drop(ignore).max()
mx = data.drop(ignore).max()
{
"embeddings": [
{
"tensorName": "300 seeds",
"tensorShape": [
1975,
100
],
"tensorPath": "https://lab.gsi.upm.es/oaraque/incel-embeddings/raw/master/300_seeds/neologisms_embeddings_2019-06-07_16-29.tsv",
"metadataPath": "https://lab.gsi.upm.es/oaraque/incel-embeddings/raw/master/300_seeds/neologisms_embeddings_words_2019-06-07_16-29.txt"
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@balkian
balkian / amazon_yeelight.py
Last active December 27, 2018 20:44
Connect dash button to yeelight
#!/bin/env python
from scapy.all import *
from yeelight import Bulb
MAC_ADDRESS = 'ac:63:be:52:8b:4a' # enter Dash Button's MAC Address here.
b = Bulb('192.168.2.240')
def detect_button(pkt):
print(pkt[Ether].src)
from soil.agents import FSM, state, default_state
from random import randint
MAX_WEALTH = 2000
class CoalitionAgent(FSM):
defaults = {
'wealth': -1,
@balkian
balkian / README.md
Created November 6, 2018 09:39
Test nslookup different k8s namespaces
kubectl apply -f pruebans1.yml
kubectl apply -f pruebans2.yml
kubectl exec -ti $(kubectl get pods -n pruebans1 --no-headers -o custom-columns=":metadata.name")  -n pruebans1 -- nslookup pruebans2.pruebans2
@balkian
balkian / descarga.ipynb
Created October 11, 2018 14:12
Descarga con bitter
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
try:
import urllib2
except ImportError:
from urllib.request import urlopen
response = urlopen('http://v4.ifconfig.co/ip')
HOSTNAME = response.read()
#!/bin/bash -x
# extract the list of submodules from .gitmodule
cat .gitmodules |while read i
do
if [[ $i == \[submodule* ]]; then
echo converting $i
# extract the module's prefix
mpath=$(echo $i | cut -d\" -f2)
@balkian
balkian / pybossa.py
Created May 10, 2018 13:57
Get the number of answers by pybossa users
# coding: utf-8
import requests
import sys
HOST = 'http://localhost'
def get_count_all(user_name, host=HOST):
user = get_user(user_name, host)