Skip to content

Instantly share code, notes, and snippets.

View scarnecchia's full-sized avatar

D. Scarnecchia scarnecchia

View GitHub Profile
@scarnecchia
scarnecchia / bsky_image.zsh
Last active March 27, 2024 05:01
This works for posting an image to bsky from the CLI
accessJwt=$(curl -X POST https://bsky.social/xrpc/com.atproto.server.createSession \
-H "Content-Type: application/json" \
-d '{"identifier": "'"$BLUESKY_HANDLE"'", "password": "'"$BLUESKY_APP_PASSWORD"'"}' | jq -j ".accessJwt")
blob=$(curl -X POST 'https://bsky.social/xrpc/com.atproto.repo.uploadBlob' \
-H "Authorization: Bearer $accessJwt" \
-H 'Content-Type: image/jpeg' \
--data-binary "@alf.jpg" | jq -r ".blob")
@scarnecchia
scarnecchia / create_sas_script.R
Last active October 5, 2023 05:14
This script uses an input file `tabvars` to write a SAS program which then reads in CSV files, formats them, and outputs them as sas7bdat datasets
#' Runs a SAS program using the specified SAS executable and program file.
#'
#' @param executable The path to the SAS executable.
#' @param saspath The path to the SAS program file.
#'
#' @return Returns nothing, but prints a message to the console indicating whether the execution was successful or not.
#'
#' @examples
#' run_sas("C:/Program Files/SASHome/SASFoundation/9.4/sas.exe", "C:/my_sas_program.sas")
#'
@scarnecchia
scarnecchia / Edet_Traktor
Created March 26, 2022 20:44
Edet Traktor in English
By fields, by fields
The blue tractor is coming to us
Someone sings a song in his trailer!
Well, baby, come on!
Try to guess it
Who, who, who, who sings the song?!
Mu-mu-mu-mu-mu-mu
Mu-mu-mu-mu-mu-mu
Mu-mu-mu-mu-mu-mu
Mu-mu-mu-mu

The hashtag #covidー19 contains the Japanese character Chōonpu, with the Univode value of U+30FC ー KATAKANA-HIRAGANA PROLONGED SOUND MARK. This is creating some search difficulties on twitter.

The following seems to work in the streaming API (using Python):

WORDS = [u'#covidー19']
try:
    listener = StreamListener(api=tweepy.API(wait_on_rate_limit=True)) 
    streamer = tweepy.Stream(auth=auth, listener=listener)
 print("Tracking: " + str(WORDS))

Quick notes regarding WSL 2 and Hugo

  1. Install Hugo through Homebrew for Linux
  2. Create a firewall rule exposing Hugo's default port (1313)
  3. Run hugo serve --bind=0.0.0.0 -b http://$(ip addr show eth0 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1):1313/ or just ifconfig and paste the IP for eth0.
@scarnecchia
scarnecchia / MongoDBissue.md
Last active January 19, 2020 20:44
MongoDB's tools for subsetting document collections are not working.

This properly subsets a collection of documents in MongoDB Compass Community:

{ 'created_at': { $gte: 'Sat Dec 21 00:00:00 +0000 2019', $lte: 'Thu 31 Dec 05:00:00 +0000 2019'}}

This does not, in Python 3.6, and returns the entire collection

`df = pd.DataFrame(list(collection.find({ 'created_at': { '$gte': 'Sat Dec 21 00:00:00 +0000 2019', '$lte': 'Thu 31 Dec 05:00:00 +0000 2019'

from __future__ import print_function
import tweepy
import json
from pymongo import MongoClient
from http.client import IncompleteRead
MONGO_HOST= 'mongodb://path/to/mongodb' # assuming you have mongoDB installed locally
WORDS = ['drone', 'drones']
@scarnecchia
scarnecchia / church_of_england.md
Last active February 18, 2019 15:32
Eddie Izzard's Church of England Bit

"Mr. Pope! I'm going to marry my first wife, and then I'm going to divorce her. Now, I know what you're going to say but stick with me, my story gets better. I'm going to marry my second wife and then I'm gong to kill her, cut her head off! Ah, not expecting that, are ya? Third wife, gonna shoot her. Fourth wife, put her into a bag. Fifth wife, into outer space. Sixth wife, on a Rotissimat. Seventh wife, made out of jam. Eighth wife…” ( makes sound similar to putting babies on spikes )

And the Pope's going,

( Italian accent )"You crazy bugger! You can't do all this! What are you, a Mormon? You can't marry all these people! It's illegal! You can't do all this! I am the Pope, I am the head of the Church, I have to keep up… ciao! I have to keep up standards. What have you been reading, the gospel according to St. Bastard?"

So Henry VIII, who was Sean Connery for this film, said:

( imitating Sean Connery ) "Well then, I will set up a new religion in this country. I will set up the Psychotic Bastard religion."

@scarnecchia
scarnecchia / # r - 2017-06-16_08-55-14.txt
Created June 16, 2017 13:07
r (homebrew/science/r) on macOS 10.12.5 - Homebrew build logs
Homebrew build logs for homebrew/science/r on macOS 10.12.5
Build date: 2017-06-16 08:55:14
@scarnecchia
scarnecchia / # r - 2017-06-16_00-59-35.txt
Created June 16, 2017 12:39
r (homebrew/science/r) on macOS 10.12.5 - Homebrew build logs
Homebrew build logs for homebrew/science/r on macOS 10.12.5
Build date: 2017-06-16 00:59:35