This is an example of Go code calling to a C++ library with a C wrapper.
go build # this only ensures it compiles| // [START initialize_firebase_in_sw] | |
| // Give the service worker access to Firebase Messaging. | |
| // Note that you can only use Firebase Messaging here, other Firebase libraries | |
| // are not available in the service worker. | |
| importScripts('https://www.gstatic.com/firebasejs/3.5.2/firebase-app.js'); | |
| importScripts('https://www.gstatic.com/firebasejs/3.5.2/firebase-messaging.js'); | |
| // Initialize the Firebase app in the service worker by passing in the | |
| // messagingSenderId. | |
| firebase.initializeApp({ |
| # | |
| # Assumes an independent box (we'll call this one "graphite") | |
| # | |
| # Stay up to date | |
| sudo apt-get update | |
| sudo apt-get upgrade | |
| # Install git | |
| sudo apt-get install g++ curl libssl-dev -y |
| $ curl -C - https://download.java.net/java/ga/jdk11/openjdk-11_osx-x64_bin.tar.gz -O openjdk-11_osx-x64_bin.tar.gz | |
| $ tar xf openjdk-11_osx-x64_bin.tar.gz | |
| $ sudo mv jdk-11.jdk /Library/Java/JavaVirtualMachines/ | |
| $ java -version | |
| openjdk version "11" 2018-09-25 | |
| OpenJDK Runtime Environment 18.9 (build 11+28) | |
| OpenJDK 64-Bit Server VM 18.9 (build 11+28, mixed mode) |
Magic words:
psql -U postgresSome interesting flags (to see all, use -h or --help depending on your psql version):
-E: will describe the underlaying queries of the \ commands (cool for learning!)-l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)| import pyaudio | |
| import wave | |
| FORMAT = pyaudio.paInt16 | |
| CHANNELS = 2 | |
| RATE = 44100 | |
| CHUNK = 1024 | |
| RECORD_SECONDS = 5 | |
| WAVE_OUTPUT_FILENAME = "file.wav" | |
| global | |
| tune.ssl.default-dh-param 1024 | |
| defaults | |
| timeout connect 10000ms | |
| timeout client 60000ms | |
| timeout server 60000ms | |
| frontend fe_http | |
| mode http |
| telegraf: | |
| image: telegraf | |
| restart: always | |
| environment: | |
| HOST_PROC: /rootfs/proc | |
| HOST_SYS: /rootfs/sys | |
| HOST_ETC: /rootfs/etc | |
| hostname: localhost | |
| volumes: | |
| - ./telegraf/telegraf.conf:/etc/telegraf/telegraf.conf:ro |
clojure higher-order functions