Skip to content

Instantly share code, notes, and snippets.

View pridkett's full-sized avatar
🕺
Rockin the town like a moldy cruton!

Patrick Wagstrom pridkett

🕺
Rockin the town like a moldy cruton!
View GitHub Profile
@dhowland
dhowland / ambientweather_telegraf.md
Last active January 26, 2024 22:27
Telegraf config for AmbientWeather API

This is the most straightforward config for parsing the Ambient Weather API into a time series database with Telegraf. I use InfluxDB to store the data and Grafana to view the data.

Note that this is not a complete Telegraf config. What follows is a fragment that you would add to the bottom of your telegraf.conf file. You must set up Influx yourself.

You MUST replace the xxxxxxxx strings in the urls parameter with your personal Application key and API key. See https://www.ambientweather.com/api.html for help if you don't have your keys.

The measurement name can be set to anything you want with the name_override parameter.

The devices endpoint gives data for all weather stations associated with your account, but this config simply takes the first one. This is done with the json_query = "0.lastData" line. Other devices could be selected by changing the 0 to another number. Properly handling multiple weather stations is too complex for any sane config of the http plugin for Telegraf. Hard

@catchdave
catchdave / replace_synology_ssl_certs.sh
Last active June 26, 2024 06:01
CLI script to programmatically replace SSL certs on Synology NAS
#!/bin/bash
#
# *** For DSM v7.x ***
#
# How to use this script:
# 1. Get your 3 PEM files ready to copy over from your local machine/update server (privkey.pem, fullchain.pem, cert.pem)
# and put into a directory (this will be $CERT_DIRECTORY).
# Personally, I use this script (https://gist.github.com/catchdave/3f6f412bbf0f0cec32469fb0c9747295) to automate steps 1 & 4.
# 2. Ensure you have a user setup on synology that has ssh access (and ssh access is setup).
# This user will need to be able to sudo as root (i.e. add this line to sudoers, <USER> is the user you create):
@kazeto
kazeto / tsv-mode.el
Created August 2, 2018 08:21
Emacs mode for TSV files.
;;; -------- TSV mode --------
(defface my-face-tsv-tab '((t (:background "black" :foreground "black"))) "Face for tabs in TSV.")
(defvar my-face-tsv-tab 'my-face-tsv-tab)
(defface my-face-tsv-2 '((t (:foreground "blue"))) "Face for 2nd column in TSV.")
(defvar my-face-tsv-2 'my-face-tsv-2)
(defface my-face-tsv-3 '((t (:foreground "yellow"))) "Face for 3rd column in TSV.")
(defvar my-face-tsv-3 'my-face-tsv-3)
@erikbern
erikbern / install-tensorflow.sh
Last active June 26, 2023 00:40
Installing TensorFlow on EC2
# Note – this is not a bash script (some of the steps require reboot)
# I named it .sh just so Github does correct syntax highlighting.
#
# This is also available as an AMI in us-east-1 (virginia): ami-cf5028a5
#
# The CUDA part is mostly based on this excellent blog post:
# http://tleyden.github.io/blog/2014/10/25/cuda-6-dot-5-on-aws-gpu-instance-running-ubuntu-14-dot-04/
# Install various packages
sudo apt-get update
@germanattanasio
germanattanasio / create-classifier.js
Last active August 29, 2015 14:27
How to create a classifier using the nodejs wrapper
'use strict';
var watson = require('../nodejs-wrapper/lib/index');
var fs = require('fs');
var natural_language_classifier = watson.natural_language_classifier({
url: 'https://gateway.watsonplatform.net/natural-language-classifier/api',
username: 'USERNAME',
password: 'PASSWORD',
version: 'v1'
@amercier
amercier / synology-scheduled-tasks.md
Last active January 10, 2024 08:31
Turn leds on/off on Synology DiskStation

Synology scheduled tasks

Usage

Go to Control Panel / Task Scheduler and add the content of these scripts as root scripts.

Leds

@dalelane
dalelane / .eslintrc
Last active October 26, 2015 18:14
.eslintrc
{
"env" : {
"node": true
},
"rules" : {
"strict": [2, "global"],
"quotes": [1, "single"],
"key-spacing": [1, { "beforeColon" : true, "afterColon" : true }],
@willurd
willurd / web-servers.md
Last active June 29, 2024 17:26
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@masayukig
masayukig / com.crashplan.engine.plist.diff
Created November 9, 2012 17:02
Getting CrashPlan to work on Mac after JDK 1.7 upgrade
diff --git a/com.crashplan.engine.plist b/com.crashplan.engine.plist
index d536a84..d189347 100644
--- a/com.crashplan.engine.plist
+++ b/com.crashplan.engine.plist
@@ -22,7 +22,7 @@
<string>/Applications/CrashPlan.app/Contents/Resources/Java</string>
<key>ProgramArguments</key>
<array>
- <string>/usr/bin/java</string>
+ <string>/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Commands/java</string>
@michiel
michiel / cors-nginx.conf
Created July 5, 2011 10:41
Wide-open CORS config for nginx
#
# Wide-open CORS config for nginx
#
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
#