Description: Setup GitHub Pages "gh-pages" branch and "master" branch as subfolders of a parent project folder ("grandmaster").
Author: Chris Jacob @_chrisjacob
Tutorial (Gist): https://gist.github.com/833223
Description: Setup GitHub Pages "gh-pages" branch and "master" branch as subfolders of a parent project folder ("grandmaster").
Author: Chris Jacob @_chrisjacob
Tutorial (Gist): https://gist.github.com/833223
| int speakerPin = 9; | |
| int length = 70; | |
| String notes[] = {"G4","G4", "G4", "D#4/Eb4", "A#4/Bb4", "G4", "D#4/Eb4","A#4/Bb4", "G4", "D5", "D5", "D5", "D#5/Eb5", "A#4/Bb4", "F#4/Gb4", "D#4/Eb4","A#4/Bb4", "G4", "G5","G4","G4","G5","F#5/Gb5", "F5","E5","D#5/Eb5","E5", "rest", "G4", "rest","C#5/Db5","C5","B4","A#4/Bb4","A4","A#4/Bb4", "rest", "D#4/Eb4", "rest", "F#4/Gb4", "D#4/Eb4","A#4/Bb4", "G4" ,"D#4/Eb4","A#4/Bb4", "G4"}; | |
| int beats[] = { 8, 8, 8, 6, 2, 8, 6 , 2 ,16 , 8, 8, 8, 6, 2, 8, 6, 2, 16,8,6,2,8,6,2,2, 2, 2,6,2,2,8,6,2,2,2,2,6,2,2,9,6,2,8,6,2,16 }; | |
| int tempo = 50; | |
| void playTone(int tone, int duration) { | |
| for (long i = 0; i < duration * 1000L; i += tone * 2) { | |
| digitalWrite(speakerPin, HIGH); | |
| delayMicroseconds(tone); |
| private static OkHttpClient getUnsafeOkHttpClient() { | |
| try { | |
| // Create a trust manager that does not validate certificate chains | |
| final TrustManager[] trustAllCerts = new TrustManager[]{ | |
| new X509TrustManager() { | |
| @Override | |
| public void checkClientTrusted(java.security.cert.X509Certificate[] chain, | |
| String authType) throws CertificateException { | |
| } |
This is a story about how I tried to use Go for scripting. In this story, I’ll discuss the need for a Go script, how we would expect it to behave and the possible implementations; During the discussion I’ll deep dive to scripts, shells, and shebangs. Finally, we’ll discuss solutions that will make Go scripts work.
While python and bash are popular scripting languages, C, C++ and Java are not used for scripts at all, and some languages are somewhere in between.
| #!/usr/bin/python | |
| # -*- coding: utf-8 -*- | |
| # | |
| # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) | |
| ANSIBLE_METADATA = {'metadata_version': '1.0', | |
| 'status': ['preview'], | |
| 'supported_by': 'community'} | |
| DOCUMENTATION = ''' |
| # Assumes the database container is named 'db' | |
| DOCKER_DB_NAME="$(docker-compose ps -q db)" | |
| DB_HOSTNAME=db | |
| DB_USER=postgres | |
| LOCAL_DUMP_PATH="path/to/local.dump" | |
| docker-compose up -d db | |
| docker exec -i "${DOCKER_DB_NAME}" pg_restore -C --clean --no-acl --no-owner -U "${DB_USER}" -d "${DB_HOSTNAME}" < "${LOCAL_DUMP_PATH}" | |
| docker-compose stop db |
| package main | |
| import ( | |
| "os" | |
| "archive/tar" | |
| "log" | |
| "io" | |
| "compress/gzip" | |
| ) |
Most recently tested on macOS Sierra (10.12.6)
curl https://bootstrap.pypa.io/get-pip.py -o ~/Downloads/get-pip.py--user flag; python ~/Downloads/get-pip.py --user. pip will be installed to ~/Library/Python/2.7/bin/pip~/Library/Python/2.7/bin is in your $PATH. For bash users, edit the PATH= line in ~/.bashrc to append the local Python path; ie. PATH=$PATH:~/Library/Python/2.7/bin. Apply the changes, source ~/.bashrc.--user when installing modules; ie. pip install <package_name> --user| <html> | |
| <head> | |
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
| <title>Example of plotting live data with websockets and highcharts</title> | |
| <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script> | |
| <script src="mqttws31.js" type="text/javascript"></script> | |
| <script type="text/javascript"> | |
| var MQTTbroker = 'test.mosquitto.org'; | |
| var MQTTport = 8080; | |
| var MQTTsubTopic = 'meriat/sala1/#'; //works with wildcard # and + topics dynamically now |