Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Writing if statements. Then, else.

Clemente Cuevas cuevasclemente

💭
Writing if statements. Then, else.
  • Erudite AI
  • Montreal, QC
View GitHub Profile
@cuevasclemente
cuevasclemente / execute_and_log_all.sh
Last active Nov 3, 2015
A cool map style paradigm to use in the shell for parallel execution and logging
View execute_and_log_all.sh
# This shows a bit of shell muscle power
# First, we call find with maxdepth 1. This will make it so that find
# only searches within this current directory
# Then we use -type f to make sure find is only getting files
# then we use \! -name 'config.json'.
# Together, these flags mean that we will get only
# files (not directories, etc.) that are not named `config.json`
# in this directory.
# Thanks to Ike Levy for helping me figure out this badassery
@cuevasclemente
cuevasclemente / getcompanies.sparql
Created Sep 18, 2015
Get all yago Company108058098 companies from dbpedia
View getcompanies.sparql
PREFIX dbpedia-owl: <http://dbpedia.org/ontology/>
PREFIX dbpprop: <http://dbpedia.org/property/>
PREFIX dbres: <http://dbpedia.org/resource/>
SELECT ?x WHERE {
?x a yago:Company108058098.
}
limit 100
View vimrc.vim
set nocompatible " be iMproved, required
filetype off " required
set shell=/bin/bash
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
set incsearch
"set list
"set listchars=tab:>.
@cuevasclemente
cuevasclemente / customjson.go
Created May 14, 2015
Custom JSON Unmarshaller
View customjson.go
package main
import (
"encoding/json"
"fmt"
)
type myStruct struct {
Field1 string
Field2 string
View weather.nim
import httpclient
import strutils
import re
var resp = get(url = "http://forecast.weather.gov/MapClick.php?zoneid=NYZ075&TextType=1")
var text = resp.body
for line in splitlines(text):
if line[0..2] == "<b>" or line[0..7] == "</table>":
echo(line.replace(re"\<.*?>"), "\n")
@cuevasclemente
cuevasclemente / weather.lisp
Created May 7, 2015
Weather App in Clisp
View weather.lisp
(require :drakma)
(require :cl-ppcre)
(defvar *weather-url* "http://forecast.weather.gov/MapClick.php?zoneid=NYZ075&TextType=1"
"The url we'll be going to, to get the weather information")
(defun starts-with (regexp string)
"Checks to see if a string starts
with the given regexp"
(eq (search regexp string) 0))
View weather.c
#define NIM_INTBITS 64
#include "nimbase.h"
#include <string.h>
#include <stdio.h>
typedef struct response182008 response182008;
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct stringtableobj145012 stringtableobj145012;
@cuevasclemente
cuevasclemente / regexps.jl
Last active Aug 29, 2015
Some of my favorite regexps, with explanations when I can remember them. Not all actually in proper Julia form necessarily
View regexps.jl
replace(searchstring,r"\w(?=\?)|(\w)$",'?'))
search(r"(?<=\().*?(?=\))", title)
search("(?=, ).*(?<=(is:))",locationstring)
match(Regex("(\\w*.?\\s){$numofwords}"),title)
@cuevasclemente
cuevasclemente / eazyE.go
Created Jan 19, 2015
eazyE: A pattern I use a lot in Go.
View eazyE.go
// eazyE is a simple syrup for error checking. It is a pattern I use often enough,
// so I decided to make a quick library out of it.
package eazyE
import (
"fmt"
"log"
)
func New(s string, err error) (fErr error) {
@cuevasclemente
cuevasclemente / Reverse.rs
Last active Aug 29, 2015
Simple reverse words commandline program
View Reverse.rs
use std::io;
fn main() {
// Readline, make sure that the line is not bad, raise error otherwise
let input = io::stdin().read_line().ok().expect("Failed to read line");
// Take the input as a string slice, rather than a String
let input_slice: &str = input.as_slice(); 4
// Get words in a vector, call reverse on it, returning an iterator,