Skip to content

Instantly share code, notes, and snippets.

View loganpowell's full-sized avatar

Logan Powell loganpowell

  • Metro DC
View GitHub Profile
@loganpowell
loganpowell / readme.md
Created January 31, 2019 22:35 — forked from jonlidgard/readme.md
PRU's on the Beaglebone Black

PRU’s on the Beaglebone - ( Using UIO with the TI Kernel )

This guide is written for fellow newbies to the BBB as an aid to understanding how to talk to the onboard PRU's. As a newbie some of my terminology and understanding may not be quite correct, however it's hopefully enough to give you an idea what is going on. The whole subject is a bit of a minefield for the beginner; a lot of things have changed over the last few years and most of the guides you come across are only partially correct, you have to pick through the bones to find the nuggets!. If you're using a modern stock debian image then blindly following them will lead to nothing but frustration. This guide will surely become irrelevant with time too but hopefully as of Oct 2017 it will be of some use.

My system

I'm using the stock debian 9.1 IOT image from Beagleboard.org on an old 2GB Beaglebone Black.

rproc & uio, Kernel images, dtb's, uboot overlays, omg wtf?

In the beginning there was the Linux Userspace I/O interface (UIO) for commu

@loganpowell
loganpowell / combining-git-repositories.md
Created December 17, 2018 14:48 — forked from msrose/combining-git-repositories.md
How to combine two git repositories.

Combining two git repositories

Use case: You have repository A with remote location rA, and repository B (which may or may not have remote location rB). You want to do one of two things:

  • preserve all commits of both repositories, but replace everything from A with the contents of B, and use rA as your remote location
  • actually combine the two repositories, as if they are two branches that you want to merge, using rA as the remote location

NB: Check out git subtree/git submodule and this Stack Overflow question before going through the steps below. This gist is just a record of how I solved this problem on my own one day.

Before starting, make sure your local and remote repositories are up-to-date with all changes you need. The following steps use the general idea of changing the remote origin and renaming the local master branch of one of the repos in order to combine the two master branches.

@loganpowell
loganpowell / inlineworker.js
Created November 20, 2018 12:27 — forked from SunboX/inlineworker.js
Create web workers without a separate worker JS files. Source: http://jsbin.com/owogib/8/
function worker() {
setInterval(function() {
postMessage({foo: "bar"});
}, 1000);
}
var code = worker.toString();
code = code.substring(code.indexOf("{")+1, code.lastIndexOf("}"));
var blob = new Blob([code], {type: "application/javascript"});
(ns react-components.core
(:require [reagent.core :as reagent :refer [atom]]))
(enable-console-print!)
(defonce app-state
(atom {:text "Hello world!"
:plain {:comment "and I can take props from the atom"}}))
(defn comment-box []
@loganpowell
loganpowell / blocking.clj
Last active September 4, 2018 13:36 — forked from martintrojer/blocking.clj
Dealing with errors and other core.async issues
;; ------------------------
(defn- log-time [{:keys [ns name line]} f & args]
(let [start (System/nanoTime)
res (apply f args)
elapsed (quot (- (System/nanoTime) start) 1000)]
(log/debug (format "%s/%s:%s %dus" ns name line elapsed))
res))
(defn enable-timing [var]
@loganpowell
loganpowell / PowerShell Customization.md
Created August 22, 2018 19:43 — forked from jchandra74/PowerShell Customization.md
PowerShell, Cmder / ConEmu, Posh-Git, Oh-My-Posh, Powerline Customization

Pimping Up Your PowerShell & Cmder with Posh-Git, Oh-My-Posh, & Powerline Fonts

Backstory (TLDR)

I work as a full-stack developer at work. We are a Windows & Azure shop, so we are using Windows as our development platform, hence this customization.

For my console needs, I am using Cmder which is based on ConEmu with PowerShell as my shell of choice.

Yes, yes, I know nowadays you can use the Linux subsystem on Windows 10 which allow you to run Ubuntu on Windows. If you are looking for customization of the Ubuntu bash shell, check out this article by Scott Hanselman.

@loganpowell
loganpowell / gh-pages-deploy.md
Created June 8, 2018 19:21 — forked from cobyism/gh-pages-deploy.md
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

const R = require('ramda')
const fetch = require('node-fetch')
const fetchJson = (f) => f.then(res => res.json())
const prepareGithubRequest = R.curry((accessToken, path) => fetchJson(fetch(`https://api.github.com/${path}?access_token=${accessToken}`)))
const fetchFromGithub = prepareGithubRequest(ACCESS_TOKEN)
const getReposFromOrg = org => fetchFromGithub(`orgs/${org}/repos`)
const getPopularRepos = R.compose(R.reverse, R.sortBy(R.prop('stargazers_count')), R.project(['name', 'stargazers_count', 'language']))
@loganpowell
loganpowell / BankItem-v1.js
Last active October 16, 2018 19:03 — forked from puppybits/BankItem-v0.js
ClojureScript & React sample code
/* next add the state to ask security questions */
render: function(){
// Now add the security challenge state
var item = null;
switch(this.state.bankState){
case "CONNECTED":
break;
case "SECURITY":
// create a new element to show questions and get answers
@loganpowell
loganpowell / curry.clj
Created April 7, 2018 23:28 — forked from sunilnandihalli/curry.clj
a macro to create fixed-arity curryable function in clojure
(defmacro def-curry-fn [name args & body]
{:pre [(not-any? #{'&} args)]}
(if (empty? args)
`(defn ~name ~args ~@body)
(let [rec-funcs (reduce (fn [l v]
`(letfn [(helper#
([] helper#)
([x#] (let [~v x#] ~l))
([x# & rest#] (let [~v x#]
(apply (helper# x#) rest#))))]