Skip to content

Instantly share code, notes, and snippets.

View technocrat's full-sized avatar

Richard Careaga technocrat

View GitHub Profile
@technocrat
technocrat / chdage.csv
Created December 15, 2019 04:05
csv version of tsv file from Applied Logistic Regression 3rd Edition by David W. Hosmer Jr., Stanley Lemeshow and Rodney X. Sturdivant (2009)
chd age
0 20
0 23
0 24
1 25
0 25
0 26
0 26
0 28
0 28
@technocrat
technocrat / renco.csv
Last active November 5, 2019 21:32
Sample data for csv problem
NombreCentral POTENCIA_BRUTA_MWH COMBUSTIBLE
RENCA - NUEVA RENCA 21 PETROLEO_2: 1.1157326 23.43038
RENCA - NUEVA RENCA 30 PETROLEO_2: 2.1904168 65.71250
RENCA - NUEVA RENCA 56 PETROLEO_2: 1.5076340 84.42751
RENCA - NUEVA RENCA 173 PETROLEO_2: 0.8375269 144.89216
RENCA - NUEVA RENCA 209 PETROLEO_2: 0.6890679 144.01519
RENCA - NUEVA RENCA 209 PETROLEO_2: 0.6831061 142.76917
RENCA - NUEVA RENCA 208 PETROLEO_2: 0.6863985 142.77089
RENCA - NUEVA RENCA 211 PETROLEO_2: 0.6803673 143.55750
RENCA - NUEVA RENCA 75 PETROLEO_2: 0.4759319 35.69489
@technocrat
technocrat / runs.csv
Created November 1, 2019 00:39
Data for a demonstration of base:rle()
0.104 0 31.6
0.083 0 31.6
0.002 0 31.6
-0.06 0 31.6
-0.048 0 31.6
0.002 0 31.6
0.021 0 31.8
0.002 0 31.8
-0.01 0 31.8
0.002 0 31.8
@technocrat
technocrat / example.tex
Created February 18, 2019 20:25
Example of a tex file
\include{preamble}
\subsection{Exercises}\label{p3-exercises}
\marginnote{p.32}
\marginnote{Notes to exercises}
\textbf{P3 vocabulary}
\begin{enumerate}
\item For the polynomial $a_nx^n + a_{n-1}x^{n-1} + \dots + a_1x + a_0$ the degree is \emph{n} and the leading coefficient is \emph{a}
\item A polynomial that has all zero coefficients is called the \emph{zero polynomial}
\item A polynomial with one term is called a \emph{monomial}
\item the letters in FOIL stand for \emph{First}, \emph{Outer} \emph{Inner} \emph{Last}
@technocrat
technocrat / make_iso.py
Created October 14, 2018 03:26
Python utility program to convert mm/dd/yyyy to ISO yyyy-mm-dd
"""
function to convert dates into date objects
"""
from datetime import datetime
import re
def canonize_date(slashdate):
"""convert date strings from 3/1/2009 to 2009-03-01"""
dateString = re.compile(r'(\d{1,2})/(\d{1,2})/(\d{4})') # match 3/1/2009
# With the help of Python scripting
deals = ["LBMLT 2006-1", "LBMLT 2006-10","LBMLT 2006-11","LBMLT 2006-2", "LBMLT 2006-3", "LBMLT 2006-4", "LBMLT 2006-5", "LBMLT 2006-6","LBMLT 2006-7", "LBMLT 2006-8", "LBMLT 2006-9", "LBMLT 2006-WL1", "LBMLT 2006-WL2", "LBMLT 2006-WL3"]
for deal in deals:
print('dealqq(\"%s\")' % deal)
'''
@technocrat
technocrat / refrag.py
Last active May 14, 2018 00:06
Preprocessor for MITxPRO Data Science and Big Data Analytics: Making Data-Driven Decisions Module 1 Case Study 1.1.1
'''
refrag.py
Author: Richard Careaga
Python: Python 3.6.4 |Anaconda custom (64-bit)
Date: 2018-05-13
URL: https://git.io/vp9Kj
Purpose:
Data wrangling for MITxPRO Data Science and Big Data Analytics: Making Data-Driven Decisions Module 1 Case Study 1.1.1
#!/usr/bin/env python
# encoding: utf-8
"""
demonstration.py
Created on 2010-07-07
Copyright (c) 2010 __Richard Careaga__ All rights reserved
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
$ 502: ip
Python 3.6.4 |Anaconda, Inc.| (default, Jan 16 2018, 12:04:33)
Type 'copyright', 'credits' or 'license' for more information
IPython 6.2.1 -- An enhanced Interactive Python. Type '?' for help.
In [1]: # Comments by Richard Careaga (Nostromo) on niemasd guarantee 2018-03-04
...: def print_info(a):
...: n = len(a)
...: avg = 0.0
...: for i in range(n):
@technocrat
technocrat / lineatime.hs
Created December 26, 2015 01:33
Read from file and output one line at a time
import Control.Monad.IO.Class (liftIO)
import Control.Monad.Trans.Resource
import Data.Conduit
import qualified Data.Conduit.Binary as CB
import qualified Data.Conduit.List as CL
import qualified Data.Conduit.Text as CT
main :: IO ()
main = runResourceT