Instantly share code, notes, and snippets.

View descarga.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View hostname.py
try:
import urllib2
except ImportError:
from urllib.request import urlopen
response = urlopen('http://v4.ifconfig.co/ip')
HOSTNAME = response.read()
View submodules2subtrees.sh
#!/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)
View pybossa.py
# coding: utf-8
import requests
import sys
HOST = 'http://localhost'
def get_count_all(user_name, host=HOST):
user = get_user(user_name, host)
View recursivedict.py
class RecursiveDict(UserDict):
def __getitem__(self, k):
if not isinstance(k, Iterable):
return self.data[k]
dest = self.data
for j in k:
dest = dest[j]
return dest
View set-default-browser.sh
xdg-settings set default-web-browser chromium.desktop
View prueba.py
NEUTRAL = 0
INFECTED = 1
class ControlModelM2(BaseBehaviour):
NEUTRAL = 0
INFECTED = 1
def step(self, now):
if self.state['id'] == NEUTRAL:
self.neutral_behaviour()
elif self.state['id'] == INFECTED:
View example.tex
\usepackage{adjustbox}
\usepackage{array}
\newcolumntype{R}[2]{%
>{\adjustbox{angle=#1,lap=\width-(#2)}\bgroup}%
l%
<{\egroup}%
}
\newcommand*\rot{\multicolumn{1}{R{45}{1em}}}% no optional argument here, please!
View 4_4.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View scrape_aliexpress.py
from selenium import webdriver
from selenium.webdriver.support.ui import Select
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
#import selenium.webdriver.firefox.webdriver as fwb
import selenium.webdriver.chrome as cwd
from selenium.webdriver.support import expected_conditions as EC
import time
import os