Skip to content

Instantly share code, notes, and snippets.

View computerphysicslab's full-sized avatar

Juan Ignacio Pérez Sacristán computerphysicslab

View GitHub Profile
@mattes
mattes / check.go
Last active July 13, 2025 08:27
Check if file or directory exists in Golang
if _, err := os.Stat("/path/to/whatever"); os.IsNotExist(err) {
// path/to/whatever does not exist
}
if _, err := os.Stat("/path/to/whatever"); !os.IsNotExist(err) {
// path/to/whatever exists
}
@computerphysicslab
computerphysicslab / php-hashtag-splitter
Last active August 29, 2015 14:19
php hashtag splitter / what does a given hashtag stand for? / hashtag segmentation algorithm
php hashtag splitter / what does a given hashtag stand for? / hashtag segmentation algorithm
This should be a 3 tier process:
1.- Using uppercase traces: #BarackObama => Barack Obama
2.- Querying a populated knowledge base or corpus of context such as obloop.com or first-thoughts.org or ritetag.com
3.- Using an English dictionary and figuring out its word composition: #socialmedia => social media
To take into account:
#nothere or #alwaysagain can be splited into multiple semantically correct segmentations.
@computerphysicslab
computerphysicslab / Best-things-of-the-day.txt
Last active August 29, 2015 14:19
Best things of the day
oftheday.org:
* APOD: http://apod.nasa.gov/apod/astropix.html
* AAPOD2: http://www.aapodx2.com/
* Earth Science Picture of the Day: http://epod.usra.edu/
* LPOD: https://lpod.wikispaces.com/
* Astronomy Sketch of the Day: ASOD: http://www.asod.info/
* Joke of the day: http://www.laughfactory.com/jokes/joke-of-the-day
* Quote of the day: http://www.brainyquote.com/quotes_of_the_day.html
Quotes about Research
If you steal from one author it's plagiarism; if you steal from many it's research.
Wilson Mizner
When a thing has been said and said well, have no scruple. Take it and copy it.
Anatole France
The greatest part of a writer's time is spent in reading, in order to write: a man will turn over half a library to make one book.
Samuel Johnson
Success and downward slopes:
Is it possible to recover from a downward slope?
A V-shaped recovery is unlikely.
downward trends: http://www.ta-stl.com/downward-and-upward-trends-from-google/
Google Trends
stagnation
business
@computerphysicslab
computerphysicslab / deepsky-spring.txt
Created May 6, 2015 16:58
From big to small, Spring Deep Sky Objects
From big to small, Spring Deep Sky Objects:
M44: The Beehive Cluster, Praesepe, or Crib (NGC 2632): 95'
M41: Open cluster in the Canis Major constellation: 38'
M101: The Pinwheel Galaxy (NGC 5457) Face-on spiral galaxy: 29' x 27'
M81: Magnificent spiral galaxy in Ursa Major. Its apparent diameter is whopping 27 x 14 arcminutes
@isidroamv
isidroamv / gz-reader.go
Last active March 13, 2024 11:48
Reading a txt gzip file with golang
func ReadGzFile(filename string) ([]byte, error) {
fi, err := os.Open(filename)
if err != nil {
return nil, err
}
defer fi.Close()
fz, err := gzip.NewReader(fi)
if err != nil {
return nil, err
@AkiyukiOkayasu
AkiyukiOkayasu / minimalWAV.go
Last active October 15, 2022 09:59
Minimal wav file read and write in Go lang
package main
import (
"os"
"github.com/go-audio/wav"
)
const filename = "pulse440_32bitFloat48kHz.wav"
@maurelian
maurelian / or.md
Created February 10, 2020 16:28
Some optimistic rollups resources I found helpful

Start with these resources