Skip to content

Instantly share code, notes, and snippets.

@jwoschitz
jwoschitz / gist:7695923
Created November 28, 2013 17:57
xmas-market-scraper
'''
dependencies:
requests
http://www.python-requests.org/
pip install requests
beautifulsoup4
http://www.crummy.com/software/BeautifulSoup/
pip install beautifulsoup4
'''
@jwoschitz
jwoschitz / gist:5686787
Last active December 17, 2015 23:08
Old brute force algo (C#)
/*
* Ugly, deprecated code, just archived as a gist
*
* If you're looking for an example implementation for a brute force algorithm,
* you may want to look at this repo: https://github.com/jwoschitz/Brutus/
*/
class Program
{
#region Private variables
@jwoschitz
jwoschitz / cleanup.py
Created February 17, 2012 20:29
directory cleanup script
'''
/* @Cleanup\Delete("SomeRandomString-123") */
// @Cleanup\Delete("asd")
'''
import os, re, argparse
class Filter():
def matches(self):
raise NotImplementedError()
@jwoschitz
jwoschitz / http_check.py
Created January 23, 2012 18:10
Simple Http check utility
import httplib
import time
def get_current_time():
return time.strftime("%Y/%m/%d %H:%M:%S", time.localtime())
def get_connection(domain, port):
if port == httplib.HTTPS_PORT:
return httplib.HTTPSConnection(domain)
return httplib.HTTPConnection(domain)
@jwoschitz
jwoschitz / gist:1473762
Created December 13, 2011 20:34
Safari & JavaScript Audio
<html>
<body>
html5 audio test
</body>
<script>
/*
tried to use the HTML5 audio without <audio /> tags, just JavaScript
works in Chrome, also in FF if you replace .mp3 with .ogg - does not work in Safari
*/
window.onload = function(){
@jwoschitz
jwoschitz / gist:1427299
Created December 3, 2011 14:48
lifts json format
/api/stations/status
============
stations: [
{
"id": 1,
"name": "U Friedrichstr.",
"lifts_total": 4,
"lifts_working": 3
},
{
@jwoschitz
jwoschitz / gist:1211105
Created September 12, 2011 12:03
Get date part in T-SQL
SELECT DATEADD(DAY, 0, DATEDIFF(DAY, 0, GETDATE()))
-- Selects the current date as datetime, e.g. 2011-09-10 00:00:00.000
SELECT CONVERT(VARCHAR(8), GETDATE(), 112)
-- Selects the current date as varchar, e.g. 20110910
@jwoschitz
jwoschitz / gist:1211077
Created September 12, 2011 11:43
Get date part in MySQL
SELECT DATE('2011-09-10 11:24:03');
#Prints 2011-09-10
SELECT CURDATE()
#Prints the current date, e.g. 2011-09-10
@jwoschitz
jwoschitz / gist:1143601
Created August 13, 2011 08:12
Create multiple batch statements with a delay in between each batch execution / T-SQL
/*
Creates multiple batch statements to run a sql statement with a delay in between each batch execution.
*/
DECLARE
@ReportTimeStamp DATETIME,
@ExitConditionTimeStamp DATETIME,
@Sql NVARCHAR(MAX),
@ParamsDefinition NVARCHAR(MAX),
@IntervalInSeconds INT,
@jwoschitz
jwoschitz / gist:1143599
Created August 13, 2011 08:11
Load a XML file with OPENROWSET
DECLARE @XML AS XML
SELECT @XML = BulkColumn FROM OPENROWSET(BULK '\\a\file\path\to\your\document.xml', single_blob) AS R