Shown at Feb '14 Den of Clojure
So you've read the blogs and thought how fun it would be to write web front ends with your favorite lisp. Perhaps you've even fired up the repl and done a little playing. But how do you get from there to a
#!/usr/bin/env python | |
import MySQLdb | |
import os, sys | |
import pprint | |
pp = pprint.PrettyPrinter() | |
mysql_host = "localhost" | |
mysql_user = "dbusername" | |
mysql_pass = "dbpassword" |
subnet 192.168.0.0 netmask 255.255.255.0 { | |
range 192.168.0.100 192.168.0.200; | |
option broadcast-address 192.168.0.255; | |
option routers 192.168.0.1; | |
on commit { | |
set ClientIP = binary-to-ascii(10, 8, ".", leased-address); | |
set ClientMac = binary-to-ascii(16, 8, ":", substring(hardware, 1, 6)); | |
log(concat("Commit: IP: ", ClientIP, " Mac: ", ClientMac, "Hostname: ", host-decl-name)); | |
execute("/usr/local/bin/dhcp-event", "commit", ClientIP, ClientMac, host-decl-name); | |
} |
Shown at Feb '14 Den of Clojure
So you've read the blogs and thought how fun it would be to write web front ends with your favorite lisp. Perhaps you've even fired up the repl and done a little playing. But how do you get from there to a
Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.
Date: 2014-10-11
Author: Fredrik Boulund
System: HP Microserver running Debian Linux (Debian 7.5 Wheezy)
TLDR: Short recipe to enable Bluetooth A2DP server that is always visible, with automatic bluetooth device pairing, and automatic pulseaudio module loading on Debian 7.5 wheezy.
Thanks to:
Joerg Schiller (https://gist.github.com/joergschiller)
Domen Puncer (https://gist.github.com/domenpuncer)
Daniel Hodgson (https://gist.github.com/Toasty27)
(:identity req)
is auth backend independent way to access user data:current-user
doesn't imply that authentication is required, route should also have :auth-rules
if authentication is required#!/usr/bin/env python | |
import requests | |
import json | |
import paho.mqtt.publish as pahopub | |
hostname = 'localhost' | |
port = 1883 | |
topic = 'owntracks/jpm/iss' | |
auth = { 'username' : 'xxx', 'password' : 'xxx' } |
from phue import Bridge | |
import colorsys, time, re, random | |
#setup bridge | |
b = Bridge('192.168.XXX.XXX') #hue bridge IP address. | |
b.connect() | |
# I grouped the different set's of fixtures in the office into arrays | |
# which made sense based on their physical locaiton in the office. | |
# The numbers in the array are the same number used in the hue app to identify |
# Add this snippet to the top of your playbook. | |
# It will install python2 if missing (but checks first so no expensive repeated apt updates) | |
# [email protected] | |
- hosts: all | |
gather_facts: False | |
tasks: | |
- name: install python 2 | |
raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal) |