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 praw # simple interface to the reddit API, also handles rate limiting of requests | |
import re | |
from collections import deque | |
from time import sleep | |
USERNAME = "Your username here" | |
PASSWORD = "Your password here" | |
USERAGENT = "Your useragent string here. It should include your /u/username as a courtesy to reddit" | |
r = praw.Reddit(USERAGENT) |
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 | |
# Click your heels together three times and say "There's no place like home." | |
chromium --incognito --new-window http://tumblr.com | |
# AND THIS PART GOES IN ~/.config/openbox/rc.xml, within the <keyboard> tag: | |
# <keybind key="A-F5"> | |
# <action name="Execute"> | |
# <startupnotify> | |
# <enabled>true</enabled> |
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
#Adopted from negativetwleve/dotfiles/tmux/tmux.conf | |
# Ring the bell if any background window rang a bell | |
set -g bell-action any | |
# Automatically renumber windows when you close one. | |
set-option -g renumber-windows on | |
# Default termtype. If the rcfile sets $TERM, that overrides this value. | |
set -g default-terminal screen-256color |
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 | |
# SEE YOU SPACE COWBOY by DANIEL REHN (danielrehn.com) | |
# Displays a timeless message in your terminal with cosmic color effects | |
# Usage: add "sh ~/seeyouspacecowboy.sh; sleep 2" to .bash_logout (or similar) in your home directory | |
# (adjust the sleep variable to display the message for more seconds) | |
# Cosmic color sequence |
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
#to make request to the website | |
import requests | |
#to scrape using BeautifulSoup | |
import bs4 | |
#to use regex | |
import re | |
#to use JSON | |
import json | |
response = requests.get('http://www.islamawareness.net/Dua/rabbana.html') |
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 json | |
from scrapy.crawler import Crawler | |
from scrapy.contrib.loader import ItemLoader | |
from scrapy.contrib.loader.processor import Join, MapCompose, TakeFirst | |
from scrapy import log, signals, Spider, Item, Field | |
from scrapy.settings import Settings | |
from twisted.internet import reactor | |
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
void checkHoldingQueue() { | |
// Check for procs in holding that have matured to priority of the ones in accepted | |
// In essence we should only check the largest proc in holding queue, but since we're not sorting it... | |
for (int i = 0; i < devices; i ++){ | |
if (holding[i] == accepted[i]) { | |
accepted[i] == holding[i]; //put it in accepted queue | |
holding[i] == -inf; //take it out of holding queue | |
} | |
} | |
} |
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
int holding_rate = 3; //speed for holding queue | |
int accepted_rate = 2; //speed for accepted queue | |
int[] accepted = {0,inf,inf,inf}; //accepted queue | |
int[] holding = {0,0,0,0}; //holding queue | |
/* BENEFIT OF SRR IS THAT PROCESSES ALREADY RUNNING DO NOT TAKE TOO LONG TO COMPLETE */ | |
void selfishRoundRobin(int timeSlice) //in seconds | |
{ | |
init(0); | |
reOrderPorts(); |
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 processing.serial.*; | |
import java.io.*; | |
import java.util.*; | |
class Node | |
{ | |
private int start_time; | |
private int end_time; | |
public Node(int a,int b) | |
{ |
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
''' | |
Give a website | |
Downloads all pdfs/pptx into the files/ folder. | |
For the future: | |
- download files as is, keeping directory structure | |
- create own directory structure based on filenames (lec01 goes to /lec, q1/p1 to /p, etc) | |
''' | |
SAVETODIR="files/" |