Skip to content

Instantly share code, notes, and snippets.

View s4nchez's full-sized avatar

Ivan Sanchez s4nchez

View GitHub Profile
@s4nchez
s4nchez / Http4kClientExample.kt
Created October 29, 2023 09:00
Example of http4k server and client
import org.http4k.client.JavaHttpClient
import org.http4k.core.Method
import org.http4k.core.Request
import org.http4k.core.then
import org.http4k.filter.DebuggingFilters.PrintResponse
fun main() {
val client = JavaHttpClient()
val printingClient = PrintResponse().then(client)
@s4nchez
s4nchez / undertow.kt
Created July 30, 2019 20:08
Configuring undertow with connection timeout
package org.http4k.server
import com.natpryce.hamkrest.assertion.assertThat
import com.natpryce.hamkrest.equalTo
import io.undertow.UndertowOptions
import io.undertow.server.handlers.BlockingHandler
import org.http4k.client.ApacheClient
import org.http4k.core.BodyMode
import org.http4k.core.HttpHandler
import org.http4k.core.Method
@s4nchez
s4nchez / reword.sh
Created April 2, 2019 11:36
Reword multiple commits in git
git -c core.editor='sed -i -E "1s/SD-12259/SD-12891/"' \
-c sequence.editor='sed -i -E "s/^pick/reword/"' \
rebase -i f7f13c01cd4e3296618a9b1546b24c19d1b2a152~1

Keybase proof

I hereby claim:

  • I am s4nchez on github.
  • I am s4nchez (https://keybase.io/s4nchez) on keybase.
  • I have a public key whose fingerprint is E4A1 E651 B032 71BD 49E8 D9BF BA72 A0C7 3ABA 533B

To claim this, I am signing this object:

@s4nchez
s4nchez / gpg_signing_and_intellij_idea.md
Created March 28, 2018 21:37
GPG signing and IntelliJ IDEA

The problem

By default, IntelliJ won't support the equivalent of git commit -S ... because that command expects a terminal to input the GPG passphrase.

The solution

Create a script that will perform the GPG signing on commits without a terminal:

gpg-no-tty.sh

@s4nchez
s4nchez / BarelyMagical.kt
Created August 22, 2017 07:50
A simple wrapper around utterlyidle
import com.googlecode.utterlyidle.*
import com.googlecode.utterlyidle.servlet.ApplicationServlet
import javax.servlet.http.HttpServlet
import javax.servlet.http.HttpServletRequest
import javax.servlet.http.HttpServletResponse
class Application(bindings: List<Binding>): HttpHandler {
val matcher = BindingMatcher(bindings = bindings)
override fun handle(request: Request): Response {
@s4nchez
s4nchez / gist:981b682a96616f7ced6c
Last active January 1, 2016 22:19
Workstation Terminal Configuration

Pre requisites

  • Mac OSX
  • Brew
  • iTerm2
  • wget
  • git

iTerm colour scheme

@s4nchez
s4nchez / topics.md
Last active December 22, 2015 21:38
Software Craftsmanship Roundtable 11/09/2013

Lightning Talks

  • Is code like milk or wine?
  • Talk to the hand
  • Curry as dependency injection
  • Scepticism Patterns
  • Less is More
  • Everybody should be a Certification Authority

Discussion Topics

@s4nchez
s4nchez / gist:4713057
Last active March 7, 2022 01:22
Command line tools every developer should know

Command line tools every developer should know

Prior reading

  • The Unix philosophy, specially the "Make each program do one thing well" [1]

Basic

  • File and directory navigation/manipulation (ls, cd, mkdir, rm, rmdir, touch, cp, mv)
  • ln/unlink/readlink
@s4nchez
s4nchez / install_rmagick.sh
Created July 25, 2012 19:41
Merge all images in directory into one
#!/bin/bash
brew install imagemagick
gem install rmagick