This file contains hidden or 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 bs4 import BeautifulSoup | |
import requests | |
import re | |
import urlparse | |
html = requests.get("http://mandalorianmercs.org/forum/index.php?board=86.0") | |
html.encoding = 'ISO-8859-1' | |
soup = BeautifulSoup(html.text, 'html.parser') |
This file contains hidden or 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 urllib.parse | |
for link in soup.find_all('a', href=re.compile('.*index.php\\?topic=')): | |
parsed = urllib.parse(link) | |
if not parsed.fragment: | |
print(link.get('href'), link.text) |
This file contains hidden or 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
(defun is-enabled-minor-mode (symbol) | |
(and (string-match (rx "-mode" eos) (symbol-name symbol)) | |
(symbol-function symbol) | |
(condition-case nil | |
(symbol-value symbol) | |
(error nil)) | |
)) | |
(let ((minor-modes '())) | |
(mapatoms #'(lambda (sym) | |
(when (is-enabled-minor-mode sym) |
This file contains hidden or 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 main(void) { | |
#define foo(a, b) \ | |
(foo * bar) | |
} | |
wat () { | |
this; | |
} |
This file contains hidden or 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
(progn | |
(require 'org) | |
(defun timestamp () | |
"Convenience wrapper around \\[org-time-stamp]" | |
(interactive) | |
(let ((org-time-stamp-formats (cons "%FT%T%z" "%FT%T%z"))) | |
(org-time-stamp '(16)) | |
(insert " "))) | |
(local-set-key (kbd "C-c C-c") 'timestamp)) |
This file contains hidden or 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
;; Unrelated to the above, but handy anyway | |
(defun ibuffer-mark-most-readonly-buffers () | |
(interactive) | |
(ibuffer-mark-on-buffer | |
#'(lambda (buf) | |
(and | |
;; Yeah, yeah, I could (defvar | |
;; ibuffer-precious-read-only-yadda-yadda) but screw that. | |
(not (string-match (rx bos "*magit: ") (buffer-name buf))) | |
(buffer-local-value 'buffer-read-only buf))))) |
This file contains hidden or 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
Character code properties: customize what to show | |
name: ASTERISK | |
general-category: Po (Punctuation, Other) | |
There are text properties here: | |
fontified t | |
front-sticky t | |
lui-format circe-format-self-say | |
lui-format-argument body | |
lui-keywords [Show] |
This file contains hidden or 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
>>> [m.groups() for m in [re.match(r'abc(\d+)def', x) for x in ['abc14def', 'xyz38def', 'asdf', 'abc3def']] if m] | |
[('14',), ('3',)] | |
>>> |
This file contains hidden or 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
git ? rebase -i --autosquash --autostash 58ededc^ | |
fatal: Needed a single revision | |
[detached HEAD 8a4481b] blah blah blah | |
Date: Wed Feb 10 23:13:09 2016 +0000 | |
Successfully rebased and updated refs/heads/consolidate-regions. | |
No stash found. | |
"git stash store" requires one <commit> argument | |
Cannot store |
This file contains hidden or 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 | |
>>> url = 'http://www.weatheraction.com/pages/pv.asp?p=wact46' | |
>>> url += "'" | |
>>> requests.get (url) | |
<Response [500]> | |
>>> response = requests.get (url) | |
>>> response.body | |
Traceback (most recent call last): | |
File "<stdin>", line 1, in <module> | |
AttributeError: 'Response' object has no attribute 'body' |