$ uname -r
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
def convert_to_json(url): | |
# get the response | |
r = requests.get(url) | |
# get the content of the response and decode from bytes to str in UTF-8 | |
response = r.content.decode() | |
# the response is a jquery object, so we need to strip off the extra jquery nonsense. | |
# the beginning of the json object is the '[' so... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask | |
import requests | |
app = Flask(__name__) | |
@app.route('/mirror-url/<url>') | |
def mirror(url): | |
r = requests.get('http://' + url) | |
return r.content |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import time | |
import sys | |
def main(): | |
base_url = 'http://investorshub.advfn.com/boards/read_msg.aspx?message_id={}' | |
times = [] | |
program_start = time.time() | |
num_pages = int(sys.argv[1]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__author__ = 'tom caruso' | |
from multiprocessing import Pool | |
import requests | |
import time | |
import sys | |
base_url = 'http://investorshub.advfn.com/boards/read_msg.aspx?message_id={id}' | |
start_message = 130084355 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE users(user_id SERIAL PRIMARY KEY, user_name TEXT); | |
CREATE TABLE mentions(mention_id SERIAL PRIMARY KEY, mention_symbol TEXT, mention_user INT REFERENCES users(user_id), mention_date TIMESTAMP DEFAULT now()); | |
INSERT INTO users (user_name) VALUES ('Tom Taylor'), ('Tom Caruso'), ('Other Rando User'); | |
INSERT INTO mentions (mention_symbol, mention_user) VALUES ('AMD', 2); | |
INSERT INTO mentions (mention_symbol, mention_user) VALUES ('APPL', 1); | |
INSERT INTO mentions (mention_symbol, mention_user) VALUES ('BLPD', 1); | |
INSERT INTO mentions (mention_symbol, mention_user) VALUES ('GALT', 1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"math" | |
) | |
type geometry interface { | |
area() float64 | |
perim() float64 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DictAttr: | |
def __init__(self): | |
self.attr1 = "Let's go" | |
self.attr2 = "Pens!" | |
def __getitem__(self, item): | |
if getattr(self, item, None): | |
return getattr(self, item) | |
else: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
read LOWERPORT UPPERPORT < /proc/sys/net/ipv4/ip_local_port_range | |
while : | |
do | |
PORT="`shuf -i $LOWERPORT-$UPPERPORT -n 1`" | |
ss -lpn | grep -q ":$PORT " || break | |
done | |
echo $PORT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
container_stop_rm () { | |
docker rm $(docker stop $1) | |
} | |
_container_stop_rm () { | |
containers=$(docker ps --format '{{ .Names }}') | |
COMPREPLY=( $(compgen -W "$containers" -- "${COMP_WORDS[COMP_CWORD]}" ) ) |
OlderNewer