Skip to content

Instantly share code, notes, and snippets.

Avatar
🤓

Shyal Beardsley shyal

🤓
View GitHub Profile
View test.py
#!/usr/bin/env python
import requests
from argparse import ArgumentParser
import pickle
limit = 50
# getting urls and dumping them into file
def get_urls():
sites = requests.get("http://readthedocs.org/api/v1/project/?limit=%s&offset=0&format=json" % limit)
objects = sites.json()['objects']
@shyal
shyal / concurrent_tornado_fetches.py
Last active Feb 15, 2017
This example shows how to use the tornado AsyncHTTPClient concurrently to perform multiple gets
View concurrent_tornado_fetches.py
from tornado import gen, web, ioloop, httpclient
import json
class MainHandler(web.RequestHandler):
@gen.coroutine
def get(self):
http_client = httpclient.AsyncHTTPClient()
time, ip, headers = yield [http_client.fetch("http://time.ioloop.io?format=json"),
View talk_gists.py
from tornado import gen, web, ioloop, httpclient
import json
class MainHandler(web.RequestHandler):
@gen.coroutine
def get(self):
http_client = httpclient.AsyncHTTPClient()
time, ip, headers = yield [http_client.fetch("http://time.ioloop.io?format=json"),
http_client.fetch("http://ip.ioloop.io?format=json"),
@shyal
shyal / tether_prints.py
Created Aug 22, 2018
This should print out how many USDT have been printed
View tether_prints.py
#########################################################
# This should print out how many USDT have been printed #
# date created: 22/08/2018 #
# date updated: 22/08/2018 #
#########################################################
import requests
import os
import json
import tempfile
View fabfile.py
import boto3
from fabric.api import sudo, task, env
import os
env.key_filename = os.path.expanduser('~/.ssh/key.pem')
env.user = 'ubuntu'
env.filter = ['running', 'stopped']
ec2 = boto3.resource('ec2')
@shyal
shyal / pushdpopd.sh
Last active Nov 7, 2018
pushd popd example
View pushdpopd.sh
#!/bin/bash
# we are supposed to be in our home directory
cd
# we make a directory called foo
mkdir foo
# we "cd" into foo, but we remember where we came from
pushd foo
View index.html
<html>
<head>
<style>
@import 'https://fonts.googleapis.com/css?family=Roboto:300,400,500';
header {
background-color: #263d36;
background-image: url("https://images.unsplash.com/photo-1511878587934-516d7ca5465b?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1689&q=80");
background-position: center top;
background-repeat: no-repeat;
@shyal
shyal / n_queen.py
Created Jan 18, 2020
n-queen algorithm animated in the terminal
View n_queen.py
from time import sleep
from os import system
"""
After spending the day trying to understand this algorithm, i decided to animated it in terminal.
Makes a lot more sense, so sharing.
"""
delay = .05
You can’t perform that action at this time.