Skip to content

Instantly share code, notes, and snippets.

View cegme's full-sized avatar
👔
sparking joy

Christan Grant cegme

👔
sparking joy
View GitHub Profile
@cegme
cegme / interpolation.py
Last active March 25, 2025 19:43
Interpolation for fitting curves. Takes 2 or more points and returns the interpolated coordinates.
import numpy as np
from scipy.optimize import curve_fit
def exponential_interpolation(points, N=330):
"""
Interpolates an exponential curve from 2 to 5 ordered points and returns N interpolated points.
Parameters:
- points: List of tuples [(x1, y1), (x2, y2), ...] (2 or more points)
@cegme
cegme / hydrasetup.sh
Last active March 29, 2020 16:55
Install directions for hydra
# Tools for installing
yum install -y wget curl epel-release
## https doesnt work :-(, there is some certificate problems
sed -i "s/mirrorlist=https/mirrorlist=http/" /etc/yum.repos.d/epel.repo
## These dev tools are a little too much
#yum groupinstall -y 'Development Tools'
@cegme
cegme / brown_tags.txt
Created February 25, 2019 20:30
NLTK Tagsets
(: opening parenthesis
(
): closing parenthesis
)
*: negator
not n't
,: comma
,
--: dash
--
@cegme
cegme / .travis.yml
Created February 18, 2019 05:11
cs3113 spring 2019 example test case
dist: xenial
language: bash
before_install:
- sudo add-apt-repository ppa:duggan/bats --yes
- sudo apt-get update -qq
- sudo apt-get install -qq bats
compiler:
- gcc
install:
- make clean
We can make this file beautiful and searchable if this error is corrected: It looks like row 9 should actually have 12 columns, instead of 2 in line 8.
Transaction_date,Product,Price,Payment_Type,Name,City,State,Country,Account_Created,Last_Login,Latitude,Longitude
1/2/09 6:17,Product1,1200,Mastercard,carolina,Basildon,England,United Kingdom,1/2/09 6:00,1/2/09 6:08,51.5,-1.1166667
1/2/09 4:53,Product1,1200,Visa,Betina,Parkville ,MO,United States,1/2/09 4:42,1/2/09 7:49,39.195,-94.68194
1/2/09 13:08,Product1,1200,Mastercard,Federica e Andrea,Astoria ,OR,United States,1/1/09 16:21,1/3/09 12:32,46.18806,-123.83
1/3/09 14:44,Product1,1200,Visa,Gouya,Echuca,Victoria,Australia,9/25/05 21:13,1/3/09 14:22,-36.1333333,144.75
1/4/09 12:56,Product2,3600,Visa,Gerd W ,Cahaba Heights ,AL,United States,11/15/08 15:47,1/4/09 12:45,33.52056,-86.8025
1/4/09 13:19,Product1,1200,Visa,LAURENCE,Mickleton ,NJ,United States,9/24/08 15:19,1/4/09 13:04,39.79,-75.23806
1/4/09 20:11,Product1,1200,Mastercard,Fleur,Peoria ,IL,United States,1/3/09 9:38,1/4/09 19:45,40.69361,-89.58889
1/2/09 20:09,Pro
@cegme
cegme / transform.py
Created February 8, 2019 03:04
Transforms json event data code to TSV formated event data
#! /usr/bin/python3
"""
This code will take in the geolocated event and turn it into csv format
Fields:
doc_id, mongo_id, code, root_code, quad_class, goldstein, source, src_actor, src_agent,
src_other_agent, target, tgt_actor, tgt_agent, tgt_other_agent, _id, date8, year, month
day, ufl, location_name, source_string, lat, lon, stateCode, countryCode, process, entities
"""
@cegme
cegme / advanced.c
Created February 5, 2019 17:54
Class notes from 2/5
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
struct _book {
int bookid : 3;
};
typedef struct _book book;
@cegme
cegme / pointer.c
Created February 1, 2019 03:46
cs3113 week 3 pointer discussion
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct book {
int id; // 4 bytes
char name[15]; // 15 bytes
};
typedef struct book book;
@cegme
cegme / librarian.py
Created February 1, 2019 03:28
Edit distance example from cs5293
# -*- coding: utf-8 -*-
mainlibrary = "The Library of Smiles 😀"
def ptable(t, s1="random", s2="rythm"):
"""Nicely print the table."""
s1 = f" {' '.join(s1)} "
print(s1)
s2 = " " + s2
@cegme
cegme / Util.hpp
Created November 25, 2018 07:40
A utility header file for logging cpp code
#ifndef UTIL_HPP_
#define UTIL_HPP_
#include <climits>
#include <string>
#include <errno>
#include <time.h>
#define MAX(a,b) ( ((a) > (b)) ? (a) : (b) )
#define MIN(a,b) ( ((a) < (b)) ? (a) : (b) )