This file contains hidden or 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 bash | |
| set -Eeuo pipefail | |
| cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 | |
| trap cleanup SIGINT SIGTERM ERR EXIT | |
| usage() { | |
| cat <<EOF |
This file contains hidden or 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
| These commands are based on a askubuntu answer http://askubuntu.com/a/581497 | |
| To install gcc-6 (gcc-6.1.1), I had to do more stuff as shown below. | |
| USE THOSE COMMANDS AT YOUR OWN RISK. I SHALL NOT BE RESPONSIBLE FOR ANYTHING. | |
| ABSOLUTELY NO WARRANTY. | |
| If you are still reading let's carry on with the code. | |
| sudo apt-get update && \ | |
| sudo apt-get install build-essential software-properties-common -y && \ | |
| sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \ |
This file contains hidden or 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
| import macros | |
| macro doNothing(input: untyped): untyped = | |
| echo treeRepr input | |
| result = input | |
| echo input.toStrLit | |
| doNothing: | |
| echo "hello world" |
This file contains hidden or 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
| import strutils | |
| import lists | |
| import re | |
| type | |
| Parser[T] = proc(input: string): Maybe[(T, string)] | |
| Maybe*[T] = object | |
| value: T | |
| hasValue: bool |
This file contains hidden or 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
| import httpclient, asyncdispatch, strutils, tables, unicode, json, math, times | |
| const | |
| ForecastUrlFormat = "http://api.openweathermap.org/data/2.5/forecast/daily?APPID=$1&lang=en&q=$2&cnt=$3" | |
| ResultFormat = """$1: | |
| $2 | |
| Temperature: $3 °C | |
| Humidity: $4% | |
| Clouds: $5% |
This file contains hidden or 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
| class Main | |
| { | |
| public static var text:String; | |
| public static function main() | |
| { | |
| var text = ""; | |
| in_macro(); |
This file contains hidden or 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
| /** | |
| * This Google Sheets script keeps data in the specified column sorted any time | |
| * the data changes. | |
| * | |
| * After much research, there wasn't an easy way to automatically keep a column | |
| * sorted in Google Sheets, and creating a second sheet to act as a "view" to | |
| * my primary one in order to achieve that was not an option. Instead, I | |
| * created a script that watches for when a cell is edited and triggers | |
| * an auto sort. | |
| * |
This file contains hidden or 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
| import Map; | |
| class OrderedMapIterator<K,V> { | |
| var map : OrderedMap<K,V>; | |
| var index : Int = 0; | |
| public function new(omap:OrderedMap<K,V>) | |
| map = omap; | |
| public function hasNext() : Bool |
This file contains hidden or 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
| var page = require('webpage').create(); | |
| page.onInitialized = function () { | |
| captureAjaxResponsesToConsole(); | |
| }; | |
| page.open('http://www.website.com/', function (status) { | |
| if (status === 'success') { | |
| phantom.exit(); | |
| } else { |
NewerOlder