Skip to content

Instantly share code, notes, and snippets.

@gfranxman
gfranxman / Makefile
Last active May 9, 2024 14:36
Makefile help target. Allows you to define groups of targets by starting a line with ## or expose a target with help test by including ## indented or after the target's dependencies.
.PHONY: help
# useage config
TARGETLEN:=$(shell echo 16)
# colors
BLUE:=$(shell echo "\033[0;36m")
GREEN:=$(shell echo "\033[0;32m")
YELLOW:=$(shell echo "\033[0;33m")
RED:=$(shell echo "\033[0;31m")
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@gfranxman
gfranxman / simple_triangulation.cc
Created January 5, 2019 17:11 — forked from cashiwamochi/simple_triangulation.cc
This code is used for simple triangulation. It uses findEssentialMat, recoverPose, triangulatePoints in OpenCV. For viewer, PCL is used. You can watch 3D points and 2 camera poses. I checked alcatraz2.jpg and alcatraz1.jpg in pcv_data.zip (https://www.oreilly.co.jp/pub/9784873116075/). Perhaps there is something wrong ( actually it looks working…
#include <opencv2/opencv.hpp>
#include <pcl/common/common_headers.h>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl/point_cloud.h>
#include <pcl/visualization/pcl_visualizer.h>
#include <Eigen/Core>
#include <Eigen/LU>
#!/usr/bin/env python
"""
Bundle the site-packages of the current python environment into a zip file
If you have any wheels at `$(pwd)/wheels`, those will be used instead of
of the locally installed packages. For instance, if my pwd looked like
wheels/
|-- numpy-1.11.2-cp27-cp27mu-manylinux1_x86_64.whl

Keybase proof

I hereby claim:

  • I am gfranxman on github.
  • I am glenn_at_sfu (https://keybase.io/glenn_at_sfu) on keybase.
  • I have a public key whose fingerprint is 1402 5418 99F7 BAB7 CFDF A350 D69B 428B 0CC2 FCFA

To claim this, I am signing this object:

import requests
rip_url = 'https://www.guitartricks.com/blog/Goodbye-Glenn-Frey-a-Fallen-Eagle?utm_source=Guitar+Tricks+Newsletter&utm_campaign=bb3aded8a8-GT_NL_Prospects_1_29_2016&utm_medium=email&utm_term=0_832235591b-bb3aded8a8-95269893'
c = requests.get( rip_url ).content
c = c.replace('Frey', 'Franxman')
c = c.replace('Lewis', '')
c = c.replace('the Eagles', 'Scripps')
c = c.replace('trouble', 'python')
c = c.replace('music', 'APIs')
@gfranxman
gfranxman / debug.py
Last active August 29, 2015 14:25
django db log for prod
import logging
import django
from django.db import connection
if django.VERSION[1] > 7:
connection.force_debug_cursor=True
else:
connection.use_debug_cursor=True
l = logging.getLogger('django.db.backends')
@gfranxman
gfranxman / tzchoices.py
Created July 10, 2015 16:17
Django US TIMEZONE Choices.
import pytz
TIMEZONES = [ (t,t) for t in pytz.common_timezones if t.startswith("US/") ]
TIMEZONES.sort( key=lambda t: pytz.timezone(t[0])._utcoffset.seconds/3600, reverse=True )
>>> TIMEZONES
[('US/Eastern', 'US/Eastern'), ('US/Central', 'US/Central'), ('US/Mountain', 'US/Mountain'), ('US/Arizona', 'US/Arizona'), ('US/Pacific', 'US/Pacific'), ('US/Alaska', 'US/Alaska'), ('US/Hawaii', 'US/Hawaii')]
>>>
@gfranxman
gfranxman / doit
Created April 15, 2015 19:17
my pypi pub process
# build
python setup.py sdist
python setup.py bdist_wheel
read
#register with test system
# python setup.py register -r pypitest
# read
# upload to test system
import inspect
class ReprFromInit( object ):
def __repr__( self ):
args = inspect.getargspec( self.__class__.__init__ ).args
path = "{modulename}.{classname}".format( modulename=self.__class__.__module__, classname=self.__class__.__name__ )
argstrs = []
for arg in args[1:]: # skip self
for argname in [ arg, "_"+arg, '' ]:
if hasattr( self, argname ):
break