Skip to content

Instantly share code, notes, and snippets.

View cosme12's full-sized avatar
🐍
Working from home

Diego Lanciotti cosme12

🐍
Working from home
  • Argentina
View GitHub Profile
import gym
import numpy as np
import random
import math
from time import sleep
## Initialize the "Cart-Pole" environment
env = gym.make('CartPole-v0')
@daggerhashimoto
daggerhashimoto / bot.py
Last active December 12, 2022 13:56
Twitch viewer bot
import requests
import subprocess
import json
import sys
import threading
import time
from Queue import Queue
import urllib3
import urllib3.contrib.pyopenssl
@CoachBirgit
CoachBirgit / sample.html
Created January 13, 2016 16:00
Sample HTML to add "Made with Love" to your site footer with the Genesis Framework.
<p class="love">Made with <i class="icon ion-heart"></i> by Brian Gardner</p>
@mattbennett
mattbennett / app.py
Last active November 19, 2021 10:12
Nameko celery integration
from flask import Flask, request
from nameko.standalone.rpc import ServiceRpcProxy
app = Flask(__name__)
@app.route('/')
def task_list():
return """
<html>
@Ivoah
Ivoah / 3d.lua
Created July 8, 2015 20:43
3D Demo for PICO-8 (http://www.lexaloffle.com/pico-8.php) with comments
--3demo
--simple 3d demo
-- Here is the data for the 3d model
-- The first section is the 3d location
-- of each point on the cube, and the
-- second section is the lines that
-- connect the points
cube = {{{-1,-1,-1}, -- points
{-1,-1,1},
@codeboy
codeboy / gist:923f74b72abda9502f42
Created February 1, 2015 15:50
A very simple example of python code to us with python-libtorrent
'''
You should try libtorrent (rasterbar). http://libtorrent.org
If you want to write your client in python, on linux, install it with:
sudo apt-get install python-libtorrent
A very simple example of python code to use it to download a torrent:
'''
import libtorrent as lt
@danielpataki
danielpataki / basics.php
Last active April 5, 2019 13:00
Creating a Plugin
<?php
/**
* Plugin Name: My Facebook Tags
* Plugin URI: http://danielpataki.com
* Description: This plugin adds some Facebook Open Graph tags to our single posts.
* Version: 1.0.0
* Author: Daniel Pataki
* Author URI: http://danielpataki.com
* License: GPL2
*/
@teechap
teechap / heatmap_example.py
Created September 18, 2014 00:35
How to make a heatmap from data stored in Python lists
'''
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
@ctokheim
ctokheim / cython_tricks.md
Last active March 4, 2024 23:27
cython tricks

Cython

Cython has two major benefits:

  1. Making python code faster, particularly things that can't be done in scipy/numpy
  2. Wrapping/interfacing with C/C++ code

Cython gains most of it's benefit from statically typing arguments. However, statically typing is not required, in fact, regular python code is valid cython (but don't expect much of a speed up). By incrementally adding more type information, the code can speed up by several factors. This gist just provides a very basic usage of cython.

@anchetaWern
anchetaWern / php-webscraping.md
Created August 4, 2013 13:18
web scraping in php

Have you ever wanted to get a specific data from another website but there's no API available for it? That's where Web Scraping comes in, if the data is not made available by the website we can just scrape it from the website itself.

But before we dive in let us first define what web scraping is. According to Wikipedia:

{% blockquote %} Web scraping (web harvesting or web data extraction) is a computer software technique of extracting information from websites. Usually, such software programs simulate human exploration of the World Wide Web by either implementing low-level Hypertext Transfer Protocol (HTTP), or embedding a fully-fledged web browser, such as Internet Explorer or Mozilla Firefox. {% endblockquote %}