Skip to content

Instantly share code, notes, and snippets.

View Kukanani's full-sized avatar

Adam Allevato Kukanani

View GitHub Profile
#!/usr/bin/env python
#
# License: BSD
# Copyright: Adam Allevato 2018
#
# FizzBuzz example program and associated tests.
#
from cStringIO import StringIO
import sys
@Kukanani
Kukanani / generate_checkerboard.py
Last active September 5, 2023 02:19
A script to generate a gazebo checkerboard. I built this while interning at Diligent Robotics in Summer 2018. The company is awesome, check them out at diligentrobots.com!
#!/usr/bin/env python
#
# Copyright (c) Diligent Robotics, 2018
# Copyright (c) Adam Allevato, 2018
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
@Kukanani
Kukanani / pandas_cheat_sheet.py
Created April 27, 2018 22:00
Pandas Cheat Sheet
import pandas as pd
import numpy as np
####################################
# BASICS
####################################
# load from CSV
# see https://chrisalbon.com/python/data_wrangling/pandas_dataframe_importing_csv/
@Kukanani
Kukanani / save_and_load_sklearn_gmm
Created April 10, 2018 22:49
Save and load a Scikit-learn GMM to file using np.save
import numpy as np
from sklearn import mixture
# make a GMM
gmm = mixture.GaussianMixture(n_components=n_components, covariance_type=cv_type)
# fit the GMM however you'd like
# save to file
gmm_name = 'new_gmm'
np.save(gmm_name + '_weights', gmm.weights_, allow_pickle=False)
@Kukanani
Kukanani / reset_git_file_permissions.sh
Last active March 9, 2018 14:03
Reset Git file permissions
git diff --no-ext-diff -p -R --no-color | grep -E "^(diff|(old|new) mode)" --color=never | git apply