A collection of Linux commands and concepts I tend to forget
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 | |
# Created by Benjamin Fleischer 2019 | |
# Distributed under the MIT license | |
# | |
# Usage: | |
# MINUTE_RANGES="0...10 30...40" ./clock echo 'we done it' | |
# DEBUG=true MINUTE_RANGES="0...10 30...40" ./clock echo 'we done it' | |
main() { | |
local ranges |
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
require './lib/adsjdbc-10.10.0.28.jar' | |
java_import java.sql.Driver | |
java_import java.sql.DriverManager | |
java_import 'com.extendedsystems.jdbc.advantage.ADSDriver' | |
class AdsAdapter | |
def initialize(connect_string) | |
@connect_string = connect_string | |
end |
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
{ | |
"$schema": "http://json-schema.org/draft-04/schema#", | |
"description": "JSON:API Schema", | |
"type": "object", | |
"properties": { | |
"link": { "$ref": "file://schemata/link.json#" }, | |
"meta": { "$ref": "file://schemata/meta.json#" } | |
} | |
} |
Step 0. Install Docker
Step 1. For your chosen project, decide where you want to store your notebooks and files in a workingfolder
.
Step 2. Open that folder in the terminal cd workingfolder
Step 3. Run this command
docker run -it --rm -v $PWD:/home/jovyan/work -p 8888:8888 jupyter/all-spark-notebook
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
module AMS | |
module V09 | |
class Serializer < ActiveModel::Serializer | |
def serializable_hash(adapter_options = nil, | |
options = {}, | |
adapter_instance = self.class.serialization_adapter_instance) | |
object.nil? ? nil : super | |
end | |
end |
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
# Finds and yields relations in batches. Adapted from record.find_in_batches since that yields | |
# arrays and we want to operate on relationships. | |
# Adapted from: | |
# https://github.com/rails/rails/blob/4-2-stable/activerecord/lib/active_record/relation/batches.rb#L98-L115 | |
def find_in_batches(target, batch_size: default_batch_size, start: nil) | |
relation = target | |
if logger && (target.arel.orders.present? || target.arel.taken.present?) | |
logger.warn("Scoped order and limit are ignored, it's forced to be batch order and batch size") | |
end | |
relation = relation.reorder(target.send(:batch_order)).limit(batch_size) |
Setup
- http://leiningen.org/ Get the repl
- Set up your ide (vim + fireplace, maybe atom, or be awesome with emacs. I don't use emacs)
Dip your beak
- https://learnxinyminutes.com/docs/clojure/ write this out in the repl to see what the code looks like.
The APIs are thorough and awesome
- https://clojure.org/about/rationale read this all the way through