Skip to content

Instantly share code, notes, and snippets.

@kracekumar
kracekumar / Writing better python code.md
Last active February 19, 2024 03:06
Talk I gave at June bangpypers meetup.

Writing better python code


Swapping variables

Bad code

@abhishek77in
abhishek77in / report.rb
Created December 9, 2012 19:31
Create a PDF Document using Prawn Library with header, footer and page numbering.
require "prawn"
Prawn::Document.generate("report.pdf") do
10.times do
start_new_page
end
repeat :all do
move_down 50
@trey
trey / django_fixtures.md
Created May 28, 2012 11:50
Use Django Fixtures to Automatically Load Data when You Install an App

Use Django Fixtures to Automatically Load Data when You Install an App

First, load some data via the admin that should always be there when someone installs the app.

Next, dump that data out into JSON format into a fixture:

$ ./manage.py dumpdata [app_name] > [app_name]/fixtures/initial_data.json

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@jelcaf
jelcaf / Operaciones-Git
Last active August 14, 2023 22:50
Git Tips - Mini-trucos de Git para facilitarme la tarea
#############################################
# Push de la rama actual
git push origin $rama_actual
#############################################
# Volver a un commit anterior, descartando los cambios
git reset --HARD $SHA1
#############################################
# Ver y descargar Ramas remotas
@burnto
burnto / gist:1266515
Created October 6, 2011 04:18
OpenCV python webcam example
#!/Users/brent/.virtualenvs/lumber/bin/python
import cv
cv.NamedWindow("w1", cv.CV_WINDOW_AUTOSIZE)
camera_index = 0
capture = cv.CaptureFromCAM(camera_index)
gx = gy = 1