Skip to content

Instantly share code, notes, and snippets.

View ronrest's full-sized avatar

Ronny Restrepo ronrest

View GitHub Profile
import string
id2char = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
char2id = {id2char[id]: id for id in range(len(id2char))}
n_vocab = len(id2char)
#!/bin/bash
# MAYAVI SETUP
# mayavi is a python library for scientific visualisations, that can handle
# visualisation of Lidar Data. But, it can also be used to project Lidar data
# to 2D images.
#
# The set of commands I used to get mayavi set up on my computer so far.
# NOTE: I still do not know if it is set up properly, so this set of steps
# might be incomplete.
@ronrest
ronrest / kitti_lidar.py
Last active August 14, 2023 03:12
Visualize Lidar Data in Kitti Data
"""
VISUALISE THE LIDAR DATA FROM THE KITTI DATASET
Based on the sample code from
https://github.com/utiasSTARS/pykitti/blob/master/demos/demo_raw.py
And:
http://stackoverflow.com/a/37863912
Contains two methods of visualizing lidar data interactively.
- Matplotlib - very slow, and likely to crash, so only 1 out of every 100
#===============================================================================
# TOY DATA
#===============================================================================
# Setting up a toy dataframe
df = data.frame(total_crime_2015_2016=674,
total_crime_2014_2015=323,
total_crime_2013_2014=212,
car_theft_2015_2016=34,
car_theft_2014_2015=45,
car_theft_2013_2014=74
@ronrest
ronrest / week_since.R
Last active August 29, 2015 14:23
Week Number since some arbitrary start date
# TODO: add an option that makes use of lubridate's quarter(date) if no value is
# entered for the *since* argument.
#===============================================================================
# WEEK_SINCE
#===============================================================================
#' @title week_since
#' @description calculates what week number some input date is, counting from
#' some specified starting date (eg the Start of Financial Year)
#' @details You can specify any start date you want by using the
@ronrest
ronrest / ngram.py
Last active August 29, 2015 14:16 — forked from pebreo/ngram.py
Pseudo Sentence Generator using Markov Chains
""" =============================================================================
This python script is for generating sentences that resemble the style of some
particular author. Does so by making use of Markov chains.
============================================================================= """
from collections import Counter
from random import choice
import re