Skip to content

Instantly share code, notes, and snippets.

@anderser
anderser / gettag.py
Created January 26, 2012 12:01
Simple python method to retrieve title tag of external page/url - or other tags..
#!/usr/bin/python
# -*- coding: utf-8 -*-
import re
import requests
def get_page_tag(url, title_re=re.compile(r'<title>(.*?)</title>', re.UNICODE )):
"""
Retrieves the title tag from a given url (or actually any tag if you want..)
@BrandonZacharie
BrandonZacharie / String.toRegExp.js
Created February 21, 2012 21:23
A JavaScript function to convert a string to a RegExp
if (!String.toRegExp)
String.toRegExp = function String_toRegExp(pattern, flags) {
return new RegExp(pattern.replace(/[\[\]\\{}()+*?.$^|]/g, function (match) { return '\\' + match; }), flags);
};
@elundmark
elundmark / url_extractor.py
Created July 21, 2012 07:31
Extract urls from webpage as list with python
#!/usr/bin/python -tt
# from: http://www.techgaun.com/2012/03/extracting-all-hyperlinks-from-webpages.html
import re, urllib2, sys
def main():
''' Usage: url_extractor.py "http://example.com/"
NOTICE: Intended for root urls; ie no */file or /subfolder/*
In that case you need to edit this file first
@johntyree
johntyree / getBlockLists.sh
Last active June 4, 2024 12:30
Make one large blocklist from the bluetack lists on iblocklist.com
#!/usr/bin/env sh
# Download lists, unpack and filter, write to stdout
curl -s https://www.iblocklist.com/lists.php \
| sed -n "s/.*value='\(http:.*=bt_.*\)'.*/\1/p" \
| xargs wget -O - \
| gunzip \
| egrep -v '^#'
@dmarx
dmarx / dl_reddit_saved_images.py
Created December 6, 2012 15:42
Downloads images from a user's saved links on reddit. Requires manual entry of username and password
"""
This script was written to illustrate libraries that could be used to improve upon
the efficiency of a script posted to /r/learnprogramming:
Original script:
https://github.com/aesptux/download-reddit-saved-images/blob/master/script.py
Reddit post
http://www.reddit.com/r/learnprogramming/comments/14dojd
/pythoncode_review_script_to_download_saved_images/
"""
from urllib2 import Request, urlopen
/*
* This is a very customized implementation of the jQuery File Upload plugin
* configured to work with nginx.
*/
$(function() {
var calculateProgress, cancelAllUploads, cancelUpload, createProgressBar,
fileName, files, maxChunkSize, startAllUploads, startUpload, uploadedFilePath;
// A container to hold all of the upload data objects.
#!/usr/bin/env python2
#
# Find and replace tracker urls in a Deluge torrents.state
import os
import sys
import platform
import shutil
import cPickle
@kissgyorgy
kissgyorgy / download_file.py
Last active November 15, 2022 10:38
Python: Download file, get file size and Content type.
import requests
r = requests.get("http://download.thinkbroadband.com/10MB.zip",
cookies={'cookie1': 'working'}
)
open('10MB.zip', 'wb').write(r.content)
@plentz
plentz / nginx.conf
Last active June 21, 2024 14:21
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@hofmannsven
hofmannsven / README.md
Last active June 17, 2024 10:34
Git CLI Cheatsheet