Skip to content

Instantly share code, notes, and snippets.

View fish2000's full-sized avatar
👉
My Python work is on the Mars helicopter, and ubiquitous on earth, and more!!!!

Alexander Böhn fish2000

👉
My Python work is on the Mars helicopter, and ubiquitous on earth, and more!!!!
  • Objects in Space and Time, LLC
  • Baltimore, MD
  • 21:48 (UTC -05:00)
  • X @fish2000
View GitHub Profile
@xu-cheng
xu-cheng / pytrace.py
Last active December 20, 2015 10:49
Create trace of your python program.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013 by Xu Cheng ([email protected])
#
import sys
if sys.version[0] == '2':
from io import open
@willurd
willurd / web-servers.md
Last active January 27, 2026 10:16
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@cldotdev
cldotdev / config
Last active February 27, 2019 05:44
bpython configuration
# This is a standard python config file
# Valid values can be True, False, integer numbers, strings
# By default bpython will look for ~/.config/bpython/config or you
# can specify a file with the --config option on the command line
# General section tag
[general]
# Display the autocomplete list as you type (default: True).
# When this is off, you can hit tab to see the suggestions.
@foresmac
foresmac / solarized.theme
Created May 3, 2013 16:31
This is designed to map Solarized Dark colors to BPython, using ANSI colors configured for OS X's Terminal via [Solarized Dark.ML.settings](https://github.com/foresmac/terminal-solarized).
# This theme attempts to map Solarized Dark colors to bpython similar to
# SublimeText 2. Requires Solarized Dark.ML.settings for Terminal.app.
# Copy to ~/.bpython/solarized.theme and
# set "color_scheme = solarized" in ~/bpython/config
[syntax]
keyword = g
name = d
comment = G
@dideler
dideler / example.md
Last active July 24, 2025 18:46
A python script for extracting email addresses from text files.You can pass it multiple files. It prints the email addresses to stdout, one address per line.For ease of use, remove the .py extension and place it in your $PATH (e.g. /usr/local/bin/) to run it like a built-in command.
#include <iostream>
#include <hdf5.h>
// Constants
const char saveFilePath[] = "test.h5";
const hsize_t ndims = 2;
const hsize_t ncols = 3;
int main()
@ktym
ktym / unwebarchive.rb
Created February 12, 2013 18:03
Extract contents of a .webarchive file.
#!/usr/bin/env ruby
#
# Mac OS X webarchive is a binary format of a plist file. You can extract the contents manually:
# 1. convert the plist file into XML by "plutil -convert xml1 file.webarchive"
# 2. parse the resulted XML file by some XML parser
# 3. decode "WebResourceData" by Base64.decode64(data) in each key
# 4. save the decoded content into a file indicated by "WebResourceData"
# Thankfully, the plist library can take care of annoying steps 2 and 3.
#
# Preparation:
#include <iostream>
#include <vector>
#include <time.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include "Frustum.h"
#include <GL/freeglut.h>
@miratcan
miratcan / fix_database_to_utf8.py
Last active August 31, 2023 00:06
Small python script that converts character sets to utf8 in all databases and tables. My solution for "Illegal mix of collations" errors. (http://stackoverflow.com/questions/3029321/how-to-solve-illegal-mix-of-collations-in-mysql)
from MySQLdb import connect
conn = connect(user="[USER]", passwd= "[PASSWORD]")
cur = conn.cursor()
cur.execute("show databases;")
dbs_to_update = filter(
lambda db: db not in ('information_schema', 'mysql', 'performance_schema'),
[dbname[0] for dbname in cur.fetchall()])
@ssokolow
ssokolow / .Xresources
Created December 1, 2012 20:52
.Xresources settings to make Motif look a bit less archaic for DDD
! ---=== Experiment with making Motif less ugly for DDD ===---
! (DDD ignores generically-set Motif properties so we must do this)
! TODO (if possible):
! - Hide text cursors in unfocused fields
! - Convert on-hover effect from shadow to background color or border
! - Pick better fonts and check which package provides them
! Use the lighter background grey from the Lubuntu GTK+ theme
! (Still a cool grey. Eyedropper the Clearlooks warm grey if necessary.)
Ddd*background: #e0e0e0