Skip to content

Instantly share code, notes, and snippets.

View robinsonkwame's full-sized avatar

Kwame Porter Robinson robinsonkwame

View GitHub Profile
@robinsonkwame
robinsonkwame / custom.js
Last active February 25, 2024 05:14
Logseq custom.js functions for creating named blocked references with CMD-T
const getBlock = async (selectedText) => {
const currentBlock = logseq.api.get_current_block();
if (currentBlock) {
const newText = `[${selectedText}](())`
const updatedContent = currentBlock.content.replace(
selectedText, newText
);
await logseq.api.update_block(
currentBlock.uuid,
updatedContent
@robinsonkwame
robinsonkwame / artisan.ttl
Last active April 20, 2022 14:17
Test .ttl for Neo4j onto import
@prefix : <urn:webprotege:ontology:d2c83e7f-4c1f-4d5d-9e25-b6561f887f46#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@base <urn:webprotege:ontology:d2c83e7f-4c1f-4d5d-9e25-b6561f887f46> .
<urn:webprotege:ontology:d2c83e7f-4c1f-4d5d-9e25-b6561f887f46> rdf:type owl:Ontology .
@robinsonkwame
robinsonkwame / auto-sklearn.txt
Last active February 9, 2020 17:30 — forked from yngtodd/auto-sklearn.txt
Installing Auto-Sklearn and Pyrfr on Mac OSX.
# For MacOS, non conda environment
xcode-select --install # install gcc, command line tools if not present
brew install swig # install wrapper, interface between C/C++ libarires (needed for pyrfr)
# Now we can install auto-sklearn, by installing the pyrfr dependency first
PIP_NO_CACHE_DIR=false
pip install pyrfr auto-sklearn # could use pipenv too
# if in Docker, can remove command line tools, etc.
@robinsonkwame
robinsonkwame / Dockerfile.ml
Created September 1, 2017 13:43
Draft ML Dockerfile
FROM python:3.6.2-slim
MAINTAINER "Kwame Porter Robinson" kporterrobinson@gmail.com
# Install JDK
# Credit: picoded/ubuntu-openjdk-8-jdk
# Add some core repos
RUN apt-get update && \
apt-get install -y sudo curl zip openssl build-essential python-software-properties software-properties-common && \
apt-get clean;
@robinsonkwame
robinsonkwame / init.twitter.yaml
Created June 7, 2017 17:05
Example PoolBasedBinaryClassification
app_id: PoolBasedBinaryClassification
args:
alg_list:
- {alg_id: RoundRobin, alg_label: RoundRobin, test_alg_label: Test}
- {alg_id: RandomSamplingLinearLeastSquares, alg_label: RandomSamplingLinearLeastSquares, test_alg_label: Test}
algorithm_management_settings:
mode: fixed_proportions
params:
- {alg_label: RoundRobin, proportion: 0.5}
- {alg_label: RandomSamplingLinearLeastSquares, proportion: 0.5}
#The MIT License
#
#Copyright (c) 2016 Kwame Porter Robinson
#
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
#in the Software without restriction, including without limitation the rights
#to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
#copies of the Software, and to permit persons to whom the Software is
#furnished to do so, subject to the following conditions:
from itertools import chain, repeat
from six.moves import reduce
def reducer(accum_value, x):
return tuple(sum(t) for t in zip(accum_value, x + (1,)))
k = (item for item in ((3,4),(4,66),(100,4)))
start = next(k)+(1,)
t = reduce(reducer, k, start)
<script>
// Adapted from http://unscriptable.com/2009/03/20/debouncing-javascript-methods/
// Works for fast typers (90+ wpm), no node.js
var debounce = function (func, threshold, execAsap) {
var timeout;
return function debounced () {
var obj = this, args = arguments;
function delayed () {
if (!execAsap)
@robinsonkwame
robinsonkwame / my_gist.py
Created February 26, 2016 21:04
my basic dag
from airflow import DAG
from airflow.operators import BashOperator, DummyOperator
from datetime import datetime, timedelta
default_args = {
'owner':'kwame',
'depends_on_past':True,
'start_date': datetime.today()-timedelta(days=7)
}
#!/usr/bin/env python
import urllib
class Worker(object):
def __init__(self, myurl):
self.myurl = myurl
def dowork(self):
resp = urllib.request.urlopen(self.myurl)