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
;; The Common Lisp library for Emacs Lisp gives us keyword arguments for defun* | |
(require 'cl) | |
(defvar projects (list) "This keeps track of all available projects.") | |
(defvar project (list) "And here's our current project.") | |
(defvar project-index (list) "This will store the project index of files.") | |
(defvar project-default-file-types '("ASCII.*")) | |
;; A project will have a name, a list of directories, (recursive and non), | |
;; and a list of file-types that we want to index. |
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 'benchmark) | |
(defun my-require (feat) | |
(if (featurep feat) | |
(message "erraneous usage: '%s'" feat) | |
(message "'%s' loaded in %.2fs" feat | |
(benchmark-elapse (load-library (symbol-name feat)))))) |
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
# Use this shell function to sanitise variables before using them with sed, | |
# or in another context where escapes might be substituted | |
funtion san { | |
echo "$1" | tr -d '\n' | xxd -plain | sed 's/\(..\)/\\x\1/g' | tr -d '\n'; } | |
# Use it like this | |
# somevar=$(san "$somevar") |
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/python2.7 | |
# Simple example of using a 'handler' function | |
# -- Chris2048 | |
def parseLine(line): | |
if line==True: | |
raise Exception() | |
return "foo" |
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/python2.7 | |
# -`*- coding: utf-8 -*- | |
""" | |
test for Server-Side events in flask | |
inspiration from: | |
http://www.html5rocks.com/en/tutorials/eventsource/basics/ | |
https://github.com/niwibe/sse.git | |
https://github.com/niwibe/django-sse.git |
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/python2.7 | |
# -`*- coding: utf-8 -*- | |
from gevent import monkey | |
monkey.patch_all() | |
import flask | |
app = flask.Flask(__name__) | |
app.debug = True | |
app.secret_key = 'asdf' |
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 | |
# | |
# Usage: ./make-lsLR.sh | |
# | |
# Purpose: | |
# to make a file that is parseable for recovering | |
# a filled /lost+found directory by parsing | |
# filesize, md5sum, permisions and path+filename | |
# | |
# Author: Ingo Juergensman - http://blog.windfluechter.net |
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/python | |
# | |
# usage: check_lostfound.py <pathtolost+found> [make_it_so] | |
# | |
# Purpose: to find files in lost+found and trying to restore | |
# original files by comparing ls-md5sum-files.txt (generated by | |
# make-lsLR.sh | |
# Option make_it_so cause the data actually being written/moved | |
# whereas the script runs in dry mode per default. | |
# |
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
#!env python2.7 | |
import feedparser | |
from datetime import datetime, timedelta | |
d = feedparser.parse("http://www.meetup.com/events/atom/MEETUP_RSS_URL/all")['entries'] | |
def getDate(content): | |
from bs4 import BeautifulSoup |
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/python2.7 | |
import requests | |
def getItems(from_date, to_date): | |
api_root = 'http://api.thriftdb.com/api.hnsearch.com/items/_search' | |
url = api_root + '?filter[fields][create_ts]=[{}+TO+{}]'.format(from_date, to_date) | |
payload = { | |
'limit': 100, | |
'sortby': 'create_ts desc', |
OlderNewer