Skip to content

Instantly share code, notes, and snippets.

Avatar
🥕

Carrot CarrotCodes

🥕
View GitHub Profile
View carrot.blog.Dockerfile
FROM --platform=$TARGETPLATFORM eclipse-temurin:18-jdk as jre-build
ARG jar
ARG docs
WORKDIR /app
RUN mkdir build
ADD $jar build/service.jar
RUN jdeps \
--ignore-missing-deps \
--multi-release 18 \
View example-patreon-campaign-members-fetcher.kt
package sponsor.api.fetcher
import io.ktor.client.HttpClient
import io.ktor.client.call.receive
import io.ktor.client.request.header
import io.ktor.client.request.parameter
import io.ktor.client.request.request
import io.ktor.client.statement.HttpResponse
import io.ktor.http.HttpMethod
import kotlinx.serialization.SerialName
@CarrotCodes
CarrotCodes / Dockerfile
Created February 21, 2021 23:10
Example of filtering RDS region-specific certificates, installed to an OpenJDK Docker image, to speed up image build time (eu-west-2)
View Dockerfile
FROM openjdk:16-jdk-buster
LABEL org.opencontainers.image.source="https://github.com/KaleCharity/snip"
ARG jar
ADD $jar /service.jar
RUN curl -sS "https://s3.amazonaws.com/rds-downloads/rds-combined-ca-bundle.pem" > rds-combined-ca-bundle.pem
RUN awk 'split_after == 1 {n++;split_after=0} /-----END CERTIFICATE-----/ {split_after=1}{print > "rds-ca-" n ".pem"}' < rds-combined-ca-bundle.pem
RUN for CERT in rds-ca-*; do \
@CarrotCodes
CarrotCodes / install_nomad_server.yaml
Last active July 25, 2018 22:08
Simple Nomad installation and updating using Ansible
View install_nomad_server.yaml
# To update to a new version of Nomad:
# Download and calculate checksums:
# http --download https://releases.hashicorp.com/nomad/0.8.4/nomad_0.8.4_linux_amd64.zip
# shasum --algorithm 256 --binary nomad_0.8.4_linux_amd64.zip
# unzip nomad_0.8.4_linux_amd64.zip
# shasum --algorithm 256 --binary nomad
# Update facts in this script
# Only run on one hashimaster at a time!
- name: Set nomad version
View extract-clusters.kt
fun extractGraphemeClusters(input: String): List<String> {
val characters = mutableListOf<String>()
val iterator = BreakIterator.getCharacterInstance()
iterator.setText(input)
var start = iterator.first()
var iterated = false
while (!iterated) {
val next = iterator.next()
@CarrotCodes
CarrotCodes / code-of-conduct.md
Last active July 20, 2017 17:37
#compsoc code of conduct
View code-of-conduct.md

#compsoc Code of Conduct

#compsoc aims at being a nice place to chat about computer related things for anyone involved with Edinburgh University.

With that in mind, there is a single rule:

  • Be nice

Not being nice could include:

View keybase.md

Keybase proof

I hereby claim:

  • I am carrotcodes on github.
  • I am carrot (https://keybase.io/carrot) on keybase.
  • I have a public key ASDeLjES8LMAdIUKm3q9b_KJyaVRIfO9Vn1du1paiU4q5wo

To claim this, I am signing this object:

@CarrotCodes
CarrotCodes / CLA-WillowChat.md
Created January 14, 2017 14:35
CLA-WillowChat
View CLA-WillowChat.md

Contributor License Agreement

The following terms are used throughout this agreement:

  • You - the person or legal entity including its affiliates asked to accept this agreement. An affiliate is any entity that controls or is controlled by the legal entity, or is under common control with it.
  • Project - is an umbrella term that refers to any and all WillowChat open source projects.
  • Contribution - any type of work that is submitted to a Project, including any modifications or additions to existing work.
  • Submitted - conveyed to a Project via a pull request, commit, issue, or any form of electronic, written, or verbal communication with WillowChat, contributors or maintainers.

1. Grant of Copyright License.

View CLA.md

Contributor License Agreement

The following terms are used throughout this agreement:

  • You - the person or legal entity including its affiliates asked to accept this agreement. An affiliate is any entity that controls or is controlled by the legal entity, or is under common control with it.
  • Project - is an umbrella term that refers to any and all CarrotCodes open source projects.
  • Contribution - any type of work that is submitted to a Project, including any modifications or additions to existing work.
  • Submitted - conveyed to a Project via a pull request, commit, issue, or any form of electronic, written, or verbal communication with CarrotCodes, contributors or maintainers.

1. Grant of Copyright License.

@CarrotCodes
CarrotCodes / example-1.kt
Last active July 6, 2016 20:02
Kotlin examples
View example-1.kt
// Data classes
data class Something(val something: String)
val output = Something("test").toString() // Something(something=test)
val equal = Something("test2") == Something("test2") // true
val notEqual = Something("test3") == Something("test4") // false