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
| def enlever_tags(html): | |
| import subprocess | |
| lynx = subprocess.Popen('/usr/bin/lynx -stdin -dump'.split(), stdin=subprocess.PIPE, stdout=subprocess.PIPE) | |
| lynx.stdin.write(str(html)) | |
| (stdout, stderr) = lynx.communicate() | |
| return stdout.strip() |
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
| #!/usr/bin/env python | |
| class CallableObject(object): | |
| def __init__(self, val): | |
| self.val = val | |
| def __call__(self): | |
| return self.val |
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
| #!/bin/bash | |
| for i in ex {{r,}{g,m},}vim vimdiff view; do | |
| ln -s $(which mvim) "/usr/local/bin/$i"; | |
| done |
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
| initial(q0). | |
| terminal(q3). | |
| arc(q0, "h", q1). | |
| arc(q1, "a", q2). | |
| arc(q2, "h", q1). | |
| arc(q2, "!", q3). | |
| aef(S) :- | |
| string_to_list(S, L), |
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
| S1 = [] | |
| S2 = [] | |
| S1.push(root) | |
| while S1: | |
| N = S1.pop() | |
| P2.push(N) | |
| if N.left is not None: |
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
| #!/bin/bash | |
| exec ssh -t "$1" tmux a -d |
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
| system_profiler SPSoftwareDataType | grep 'System Version' | cut -d ':' -f 2 | cut -d '(' -f 1 | sed "s/^.//" |
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
| ( [ -f /var/run/lighttpd.pid ] && [ $(pgrep lighttpd | head -n 1) = $(head -n 1 /var/run/lighttpd.pid) ] ) || ( | |
| /etc/init.d/lighttpd restart | |
| echo \ | |
| "To: webmaster@netsoc.tcd.ie | |
| From: root@cubewww.netsoc.tcd.ie | |
| Subject: Automated restart of lighttpd | |
| Attempted automated restart of lighttpd on $(date) | |
| " | sendmail "webmaster@netsoc.tcd.ie" | |
| ) |
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
| [q for q in[range(90)[x:x+4]for x in range(90-4)]if sum(q)==90].pop() |
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
| #include <stdio.h> | |
| int main() { | |
| int n, k; | |
| n = 12345; | |
| while (n >= 1) { | |
| k = n%10; | |
| printf("%d\n", k); | |
| n /= 10; | |
| } |