Skip to content

Instantly share code, notes, and snippets.

View cosmocatalano's full-sized avatar
🤡
all day every day

Cosmo Catalano cosmocatalano

🤡
all day every day
View GitHub Profile
@cosmocatalano
cosmocatalano / zsh-functions.sh
Last active April 30, 2023 16:34
zsh function with user-supplied parameter
hello() {
echo "Hello, $1"
}
# % hello world
# outputs
# Hello, world
twoParams() {
echo "$1, $2"
@cosmocatalano
cosmocatalano / non-roman-regex.txt
Created August 8, 2022 20:26
Regex to Find Non-Roman Characters That Might Break XML
[^a-z,A-Z,0-9,\<,\>,\?,\.,\,,\",\",\',\=,\-,\_,\:,\/,\|,\s]
@cosmocatalano
cosmocatalano / input.scss
Created March 14, 2021 14:28
Generated by SassMeister.com.
$unit: 6px; /*scalable*/
$ship-axis: 16; /*for humans*/
/*colors*/
$teal: teal;
$orange: orange;
$yellow: yellow;
$blue: blue;
$purple: magenta; //i kno wtf
$pink: purple; //lol
<?php
function fix_file($source) {
$problems = array(
"/(<trkpt.*)\/>/",
"/<\/trkseg>\s*<trkseg>/"
);
$fixes = array(
"$1></trkpt>",
@cosmocatalano
cosmocatalano / untappd_scrape.py
Last active December 14, 2015 02:19
Quick-and-dirty web-to-JSON scrape to get info on your most recent beer. Should be readily adaptable.
#!/usr/bin/python
from bs4 import BeautifulSoup #you will probably have to install this: http://www.crummy.com/software/BeautifulSoup/
import urllib2
import sys
import cgitb
import string
import json
#This takes a URL and turns it into BeautifulSoup object
@cosmocatalano
cosmocatalano / instagram_scrape.php
Last active August 6, 2023 07:32
Quick-and-dirty Instagram web scrape, just in case you don't think you should have to make your users log in to deliver them public photos.
<?php
//returns a big old hunk of JSON from a non-private IG account page.
function scrape_insta($username) {
$insta_source = file_get_contents('http://instagram.com/'.$username);
$shards = explode('window._sharedData = ', $insta_source);
$insta_json = explode(';</script>', $shards[1]);
$insta_array = json_decode($insta_json[0], TRUE);
return $insta_array;
}
@cosmocatalano
cosmocatalano / check_limit.php
Last active December 16, 2015 04:33
A short script to check in with Twitter and see how many more unauthenticated requests you can make to their API. Handy for shared hosting accounts, especially if your host is GoDaddy.
<?php
function api_pull($url) {
$API_object = file_get_contents($url);
$array = json_decode($API_object, TRUE);
return $array;
}
$now = time();