Skip to content

Instantly share code, notes, and snippets.

🐍
Working from home

cosme12

🐍
Working from home
Block or report user

Report or block cosme12

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:1dd3d63aa47c77960fc8be241590dc18
<!-- Email Form -->
<script>
$(document).ready(function() {
//Save references to elements. Don't do DOM walks in event handlers when not needed.
var $sendEmailEl = $('#send-email');
var $subjectEl = $('#form-subject');
var $bodyEl = $('#form-message');
function updateEmailLink() {
$sendEmailEl.attr('href', 'mailto:contact@zane.sh?' +
'subject=' + encodeURIComponent($subjectEl.val()) +
@cosme12
cosme12 / ejemplo_api.py
Created Aug 31, 2018
Ejemplo de como usar Requests
View ejemplo_api.py
import requests
r = requests.get('https://api.opendota.com/api/heroes')
# Con esto obtenemos todos los datos de la pagina
print(r.text)
# Ahora tenemos que usar json para parsear los datos. Porque sino tenes un string mega gigante
import json
# Transformamos todo el muro de texto en un diccionario
heroes_dict = json.loads(r.text)
@cosme12
cosme12 / snakecoin-server-full-code.py
Created Jan 13, 2018 — forked from aunyks/snakecoin-server-full-code.py
The code in this gist isn't as succinct as I'd like it to be. Please bare with me and ask plenty of questions that you may have about it.
View snakecoin-server-full-code.py
from flask import Flask
from flask import request
import json
import requests
import hashlib as hasher
import datetime as date
node = Flask(__name__)
# Define what a Snakecoin block is
class Block:
@cosme12
cosme12 / ShortIntroToScraping.rst
Last active Jan 5, 2018 — forked from bradmontgomery/ShortIntroToScraping.rst
Really short intro to scraping with Beautiful Soup and Requests
View ShortIntroToScraping.rst
View dice_simulator.py
#For a more advanced example look here: http://copitosystem.com/courses/dice-simulator-course/
import random
while True:
rolled = random.randint(1,6)
print("The dice rolled and you got: ", rolled)
input("Press enter key to roll again.")
View pico8_circulo.p8
x = 64
y = 64
function _update()
if (btn(0)) then x=x-1 end
if (btn(1)) then x=x+1 end
if (btn(2)) then y=y-1 end
if (btn(3)) then y=y+1 end
end
@cosme12
cosme12 / heatmap_example.py
Last active Jul 24, 2016 — forked from teechap/heatmap_example.py
How to make a heatmap from data stored in Python lists
View heatmap_example.py
'''
Most heatmap tutorials I found online use pyplot.pcolormesh with random sets of
data from Numpy; I just needed to plot x, y, z values stored in lists--without
all the Numpy mumbo jumbo. Here I have code to plot intensity on a 2D array, and
I only use Numpy where I need to (pcolormesh expects Numpy arrays as inputs).
'''
import matplotlib.pyplot as plt
import numpy as np
#here's our data to plot, all normal Python lists
View ubicacion.php
<?php
/*
################################################
FECHA: 22/2/2016
CREADO POR: COSME-FULANITOS
AQUI ESTOY KIO4.COM
CONFIGURACION:
- enviar las coordenadas con el siguiente formato: -0.27907,-78.48124
EJEMPLO:
- http://kio4.com/ubicacion.php?coords=-0.27907,-78.48124
View index.php
<?php
/*
################################################
FECHA: 15/1/2016
CREADO POR: COSME-FULANITOS Y KADARYAN
SISTEMA BASICO DE SHOUTS DE TARINGA
CONFIGURACION:
- crear un archivo de texto en el mismo directorio que se llame "historial.txt"
NOTA:
@cosme12
cosme12 / TaringaBotFavTema.js
Created Jul 16, 2014
Taringa Bot Tema Favoritos
View TaringaBotFavTema.js
/* Para agregar temas a favoritos cada 3 segundos empezando desde z y bajando de a 1 repitiendo w veces.
Pegar este codigo en la consola de tu explorador.
IMPORTANTE: asegurate de estar dentro de un tema de alguna comunidad o el script no funcionara */
var i = 0;
var x = 0;
var z = 8772206;
var w = 10; // cantidad de temas a favoritos (numero alto para que nunca termine)
You can’t perform that action at this time.