Skip to content

Instantly share code, notes, and snippets.

View jmaupetit's full-sized avatar

Julien Maupetit jmaupetit

View GitHub Profile
@jmaupetit
jmaupetit / 20121015_DjangAuvergne_Meetup.md
Created October 15, 2012 22:30
Compte-Rendu du premier Meetup DjangAuvergne

Compte-Rendu du premier Meetup DjangAuvergne

  • Date : 15 octobre 2012
  • Lieu : Ness Pub de Clermont-Ferrand
  • Etaient présents (2 poneys motivés) : Alexis Couronne (@skitoo) et Julien Maupetit (@julienmaupetit)

Les attentes de la communauté

Lors de cette première réunion, l'ordre du jour était de définir ce que chacun attendait de la communauté Django Auvergnate.

@jmaupetit
jmaupetit / ghost_capture_pdf.py
Created December 5, 2012 17:57
Ghost.py capture to PDF
from ghost import Ghost
from PySide.QtGui import QApplication, QImage, QPainter, QPrinter
class MyGhost(Ghost):
def capture_pdf(self):
printer = QPrinter(QPrinter.HighResolution)
printer.setResolution(300)
printer.setOutputFileName("QtPrinter.pdf")
printer.setPaperSize(QPrinter.A4)
#!/usr/bin/eval PYTHON_VERSION=2.6 PYTHONPATH=/your/python/path/ python
import os
import sys
_PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, _PROJECT_DIR)
sys.path.insert(0, os.path.dirname(_PROJECT_DIR))
_PROJECT_NAME = _PROJECT_DIR.split('/')[-1]
os.environ['DJANGO_SETTINGS_MODULE'] = "%s.settings" % _PROJECT_NAME
/**
* Casper script to restart Alwaysdata processes.
*
* Usage:
* $ casperjs kill.js [email protected] mysecretpassword
*/
var casper = require('casper').create();
casper.start("https://admin.alwaysdata.com/login/");
@jmaupetit
jmaupetit / git_remove_history.sh
Created September 26, 2013 21:25
Remove git history and preserve submodules
# Taken from http://stackoverflow.com/a/13102849
git checkout --orphan newBranch
git add -A # Add all files and commit them
git commit
git branch -D master # Deletes the master branch
git branch -m master # Rename the current branch to master

Keybase proof

I hereby claim:

  • I am jmaupetit on github.
  • I am jmaupetit (https://keybase.io/jmaupetit) on keybase.
  • I have a public key whose fingerprint is 0A75 D5AE C0B6 FD1B 7567 A86F D342 935F 09A4 B0CF

To claim this, I am signing this object:

@jmaupetit
jmaupetit / watson_prompt.bash
Last active May 3, 2016 10:30
Watson Bash Prompt
# Add this to your ~/.provile or ~/.bashrc depending on your system
#
# watson directory (require watson >= 1.3)
# This value is the default on MacOSX
WATSON_DIR="$HOME/Library/Application Support/watson"
watson_status() {
# colors taken from git-aware-prompt
# https://github.com/jimeh/git-aware-prompt
local txtred="$(tput setaf 1 2>/dev/null || echo '\e[0;31m')" # Red
@jmaupetit
jmaupetit / dateparser_vs_dateutil.py
Created October 6, 2016 15:57
dateparser.parse vs dateutil.parser.parse
#!/usr/bin/env python3
"""Compare (fuzzy) dateutils vs dateparser `parse` methods"""
import sys
from dateparser import parse as dp_parse
from datetime import datetime, timedelta
from dateutil.parser import parse as du_parse
NOW = datetime.now()
@jmaupetit
jmaupetit / python-102.ipynb
Last active March 9, 2017 10:57
Software Carpentry Workshop - Freiburg, 2017/03/10
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jmaupetit
jmaupetit / fix_watson_uuids.py
Created June 6, 2017 14:47
Fix TailorDev Watson uuids in frames
#!/usr/bin/env python3
"""
Use this script if you have corrupted frames in your watson history. In my
case, almost 400 frames had short ids instead of 32 chars uuids.
Usage:
$ cd path/to/watson/dir
$ wget GIST_URL -O fix_watson_uuids.py
$ python3 fix_watson_uuids.py