Skip to content

Instantly share code, notes, and snippets.

View raypereda's full-sized avatar

Ray Pereda raypereda

  • Genesis Research Group
  • Long Beach, CA
View GitHub Profile
@raypereda
raypereda / app11.py
Last active April 17, 2023 22:56
stream-gist
# from collections import namedtuple
# import altair as alt
# import math
# import pandas as pd
import streamlit as st
"""
# Welcome to Streamlit!
"""
@raypereda
raypereda / test_parse_detail_xml.py
Created April 15, 2022 15:11
an example of parsing PubMed XML file using the
# from requirements.txt
## Nice PubMed XML file parser; @42c8ccc is at version 0.3.0
#git+git://github.com/titipata/pubmed_parser.git@42c8ccc
## library for processing XML and HTML in the Python language, https://lxml.de/
#lxml
from info import ArticleInfo
from info import AuthorInfo
from pprint import pprint
@raypereda
raypereda / interactive shell for debugging.py
Created April 20, 2021 18:21
like binding.pry in Ruby
import code; code.interact(local=dict(globals(), **locals()))
@raypereda
raypereda / latency.txt
Created January 28, 2021 17:50 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@raypereda
raypereda / csv-fixer.rb
Created November 12, 2019 16:36
escapes double-quotes in the last field of a CSV line
line = '1,2,3,4,5,"He said "thanks" to the cashier"'
p line
# "1,2,3,4,5,\"He said \"thanks\" to the cashier\""
parts = line.split(",", 6)
p parts
# ["1", "2", "3", "4", "5", "\"He said \"thanks\" to the cashier\""]
text = parts[5]
p text
@raypereda
raypereda / main.go
Created November 26, 2018 06:22 — forked from Hubro/main.go
Line counter written in Go
package main
import (
"bytes"
"fmt"
"io"
"os"
)
tf history /collection:http://tfs.molina.mhc:8080/tfs/HSS/ $/HSS /recursive /v:D11/09/2017~D11/09/2018 /noprompt
Changeset User Date Comment
--------- ----------------- ----------
212041 Pawar, Ganeshrao 11/9/2018 CPL Vendor
212040 TFSSERVICE 11/9/2018 Updating file
212039 TFSSERVICE 11/9/2018 Updating file
212038 TFSSERVICE 11/9/2018 Updating file
212037 Kottam, Archana 11/9/2018 added checkpoint to avoid transaction log full error
@raypereda
raypereda / dir-file-count.sh
Last active November 6, 2018 05:55
count the number of files in the directories 1 level below
find . -maxdepth 1 -exec echo {} \; -exec sh -c "find {} | wc -l " \;
@raypereda
raypereda / physics1.py
Last active August 9, 2017 00:02
debugging physic number crunching
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 8 12:33:35 2017
@author: paul
"""
from math import *
from pylab import plot,show,suptitle,xlabel,ylabel,scatter,grid,legend,title,figure,ylim,xlim,subplots
@raypereda
raypereda / Update remote repo
Last active May 12, 2018 06:06 — forked from mandiwise/Update remote repo
Transfer repo from Bitbucket to TFS
// Reference: http://www.blackdogfoundry.com/blog/moving-repository-from-bitbucket-to-github/
// See also: http://www.paulund.co.uk/change-url-of-git-repository
// These are steps for moving a git repo from Bitbucket to TFS
// 1. add your SSH keys to the TFS project (google for a guide)
// 2. follow the steps below
git clone git@bitbucket.org:<bitbucket_user>/<repo_name>.git
cd repo_name
git remote rename origin bitbucket