Skip to content

Instantly share code, notes, and snippets.

Michał Oleniec tourist

  • Poland
View GitHub Profile
@tourist
tourist / maintenance.html
Last active Aug 29, 2015 — forked from pitch-gist/gist:2999707
HTML: Simple Maintenance Page (mobile friendly)
View maintenance.html
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 20px; }
@media (min-width: 768px){
body{ padding-top: 150px; }
}
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; max-width: 650px; margin: 0 auto; }
@tourist
tourist / ssh tunneling.md
Last active Aug 29, 2015 — forked from mhulse/ssh tunneling.md
SSH Tunneling: Map port from remote machine to your local machine so you can work from the remote DB (example using Django DB settings)...
View ssh tunneling.md

SSH Tunneling

  1. In your local_settings.py file:

    DATABASES = {
    	'default': {
    		'ENGINE': 'django.db.backends.postgresql_psycopg2',
    		'NAME': 'django_%s' % (PROJECT_NAME,),
    		'USER': xxxx,
    
View xss_test
';alert(String.fromCharCode(88,83,83))//';alert(String.fromCharCode(88,83,83))//";
alert(String.fromCharCode(88,83,83))//";alert(String.fromCharCode(88,83,83))//--
></SCRIPT>">'><SCRIPT>alert(String.fromCharCode(88,83,83))</SCRIPT>
VM239:3 '';!--"<XSS>=&{()}
VM239:3 <SCRIPT SRC=http://ha.ckers.org/xss.js></SCRIPT>
VM239:3 <IMG SRC="javascript:alert('XSS');">
View gulpfile.js
'use strict';
var gulp = require('gulp');
var gutil = require('gulp-util');
var del = require('del');
var uglify = require('gulp-uglify');
var gulpif = require('gulp-if');
var exec = require('child_process').exec;
var notify = require('gulp-notify');
@tourist
tourist / mmr_workout_gpx_export.py
Last active Feb 16, 2019
Exports workouts data from MapMyFitness API (MapMyRun and other MapMy* apps) to *.gpx file including timestamps. Might be used to import to another apps. MapMyFitness web interface offers export to *.gpx but without timestamps. Originaly used to move my data to Endomondo.
View mmr_workout_gpx_export.py
# quick & dirty export of workouts to *.gpx file with timestamps from MapMyFitness API
# for purpose of moving to other apps (tested with Endomondo)
# based on: https://developer.mapmyapi.com/docs/read/Authentication2
# needs API access request "Request a key" @ https://developer.mapmyapi.com/
from __future__ import unicode_literals
import requests
import urlparse
import webbrowser
import json
from requests_oauthlib import OAuth2
@tourist
tourist / _xls.py
Last active Aug 4, 2018
modified _xls.py from tablib for auto row height & auto colum width and proper alignment
View _xls.py
# -*- coding: utf-8 -*-
""" Tablib - XLS Support.
"""
import math
import sys
import itertools
from tablib.compat import BytesIO, xlwt
@tourist
tourist / custom_filterspec.py
Created May 17, 2012
FilterSpec custom queryset for Django 1.3
View custom_filterspec.py
# models.py
class Link(models.Model):
.....
place = models.ManyToManyField("PlaceForLink", through="LinkPlace", related_name="link")
.....
place.hasplace_filter = True
# filters.py
class HasPlaceFilterSpec(FilterSpec):
def __init__(self, f, request, params, model, model_admin, field_path=None):
@tourist
tourist / sitecache.py
Created Mar 20, 2012 — forked from Ciantic/sitecache.py
My Site object cache
View sitecache.py
"""Cache of Site related settings
Site IDs and urlconfs are such that are testd on *all* requests thus they need
to be cached.
"""
from django.conf import settings
from django.contrib.sites.models import Site
View multisitedmiddleware.py
"""Allows serving multiple sites per Django instance
"""
from django.utils.cache import patch_vary_headers
from sitecache import get_site_id, get_urlconf
class MultiSitedMiddleware:
@tourist
tourist / Reviewing profiles
Created Jun 9, 2011 — forked from mmalone/Reviewing profiles
Replacement Django runserver command that does profiling... because I've rewritten this too many times.
View Reviewing profiles
>>> import pstats
>>> p = pstats.Stats('p.1258156459.52174278XcQE.prof')
>>> p.strip_dirs().sort_stats(-1).print_stats(5)
Fri Nov 13 15:54:20 2009 p.1258156459.52174278XcQE.prof
124278 function calls (122386 primitive calls) in 0.589 CPU seconds
Ordered by: standard name
List reduced from 1014 to 5 due to restriction <5>
You can’t perform that action at this time.