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 itertools import product | |
from random import choice | |
# Cool story, bro. alternatives | |
# by @andrewdanks | |
# Prints all combinations iff True; prints a random sentence otherwise. | |
print_all_combos = False | |
story_adjectives = ['intriguing', 'riveting', 'gripping', 'fascinating', 'compelling', 'charming', 'dazzling'] |
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
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteRule ^index\.php$ - [L] | |
RewriteRule (.*) ./index.php?id=$1 [L] | |
</IfModule> |
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
{% comment %} | |
To add a companion product to the cart automatically if a primary product is in cart: | |
1. Create a new link list under your Navigation tab. | |
2. In that link list, make the first link point to companion product. | |
3. Copy your link list handle where indicated at line 8: | |
{% endcomment %} | |
{% assign linklist = linklists['put-your-link-list-handle-here'] %} | |
{% comment %} |
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 -ex | |
# | |
# configures wordpress file permissions based on recommendations | |
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions | |
# | |
# script is aware of .git directories by default. edit if you need to consider | |
# other folders as well. | |
# | |
# you will find a log file in /tmp/ in case you fucked up. |
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 scrapy | |
from scrapy.contrib.spiders import CrawlSpider, Rule | |
from scrapy.contrib.linkextractors.lxmlhtml import LxmlLinkExtractor | |
from buzzLinks.items import BuzzlinksItem | |
from urlparse import urlparse | |
# Spider | |
class DmozSpider(CrawlSpider): | |
name = "buzzfeedNews" | |
allowed_domains = ["buzzfeed.com"] |
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
{% comment %} | |
To add a companion product to the cart automatically if a primary product is in cart: | |
1. Create a new link list under your Navigation tab. | |
2. In that link list, make the first link point to companion product. | |
3. Copy your link list handle where indicated at line 9 | |
4. Set the minimum cart total required for the bonus product on line 10 | |
{% endcomment %} | |
{% assign linklist = linklists['put-your-link-list-handle-here'] %} | |
{% assign min_total = 100 %} |
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
require 'yaml' | |
task :deploy do | |
# add check if file exists etc | |
keys = YAML::load(File.open('keys.yml')) | |
token = keys['token'] | |
secret = keys['secret'] | |
# add check for empty values etc |
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 json | |
headers = {'User-Agent': 'android:subgrowth:v0.1 (by /u/twelvis)'} | |
def getit(subreddit): | |
r = requests.get( | |
'http://www.reddit.com/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
def get_headers(s, sep=': ', strip_cookie=True,strip_cl=True, strip_headers:list=[]) -> dict(): | |
l = s.split('\n') | |
d = dict() | |
for kv in l: | |
if kv: | |
k = kv.split(sep)[0] | |
v = kv.split(sep)[1] | |
if strip_cookie and k == 'cookie': continue | |
if strip_cl and k == 'content-length': continue | |
if k in strip_headers: continue |
OlderNewer