This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; Terminal notifier | |
;; requires 'sudo port install terminal-notifier' | |
;; stolen from erc-notifier | |
;; | |
;; (terminal-notifier-notify "Emacs notification" | |
;; "Something amusing happened") | |
(defvar terminal-notifier-command | |
(executable-find "terminal-notifier") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; copilot-helper --- Just helping run copilot safely. | |
;;; Commentary: | |
;; Reworking of https://github.com/zerolfx/copilot.el and | |
;; https://robert.kra.hn/posts/2023-02-22-copilot-emacs-setup/ | |
;;; Code: | |
(use-package copilot | |
:straight (:host github :repo "zerolfx/copilot.el" :files ("dist" "*.el")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Compute the distances between all US Zipcodes. | |
## To save time we just compute the diagonal and use multiple cores. | |
require(parallel) | |
library(geosphere) | |
library(MASS) | |
library(zipcode) | |
data(zipcode) | |
## Uncode for testing | |
## zipcode <- zipcode[1:10,] | |
zips.num = dim(zipcode)[1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from adafruit_ble import BLERadio | |
# from adafruit_ble.advertising import Advertisement | |
# from adafruit_ble.advertising.standard import ProvideServicesAdvertisement | |
found = set() | |
scan_responses = set() | |
running = True | |
count = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from bluepy import btle | |
import struct | |
class LumeCube: | |
def __init__(self, mac): | |
self.mac = mac | |
self.SERVICE_UUID = "33826A4C-486A-11E4-A545-022807469BF0" | |
self.LIGHT_CHARACTERISTIC = "33826A4D-486A-11E4-A545-022807469BF0" | |
self.LIGHT_ON = struct.pack('>L', 0xFCA16400) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install brew from https://brew.sh/ then install dfu-util | |
brew install dfu-util | |
# OR install dfu-util from http://dfu-util.sourceforge.net/ | |
# | |
# then plug in and power on your device holding the D and Down buttons | |
# now find your device | |
dfu-util -l | |
# Verify that alt=0 is name="@Internal Flash..." | |
dfu-util -a 0 -D Midicommander_line6HX3x_V5.dfu | |
# Wait for it to finish...you should be good... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library("ggplot2") | |
dataUrl <- "https://covidtracking.com/api/states/daily.csv" | |
c <- read.csv(dataUrl) | |
c$date <- as.Date(as.character(c$date), format = "%Y%m%d") | |
c_tmp <- c[order(c[c$date == max(c$date), ]$total, decreasing = TRUE), ] | |
states <- c_tmp[c_tmp$date == max(c_tmp$date), ]$state[1:10] | |
c[is.na(c$pending), ]$pending <- 0 | |
c$ratio <- (c$positive / (c$total - c$pending)) | |
c <- c[c$state %in% states, ] | |
g <- ggplot(c, aes(x = date, y = ratio)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# This is a simple Twitter bot which listens to a track stream for a comma delimited | |
# list of terms/tags (PRIMARY_TRACK_LIST). From this stream, it will retweet any | |
# tweet that matches the secondary regex (SECONDARY_REGEX_FILTER). | |
# | |
# This example is a #Haiti & #Chile Twitter stream listener for TweakTheTweet syntax. | |
# | |
# Requires Python 2.6 | |
# Requires Tweepy http://github.com/joshthecoder/tweepy | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f.name <- "file.csv" | |
f.command <- paste("wc -l", | |
f.name, | |
"| cut -d \" \" -f 2") | |
f.rows <- as.numeric(system(f.command, intern = TRUE)) | |
f <- read.csv(f.name, | |
nrows=f.rows, | |
col.names=c("user", "phone", "total", "percent"), | |
colClasses=c("numeric","numeric","numeric","numeric"), | |
header=FALSE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## From: https://tensorflow.rstudio.com/keras/ | |
library(keras) | |
mnist <- dataset_mnist() | |
x_train <- mnist$train$x | |
y_train <- mnist$train$y | |
x_test <- mnist$test$x | |
y_test <- mnist$test$y | |
## reshape |
NewerOlder