Skip to content

Instantly share code, notes, and snippets.

David Liman dvliman

Block or report user

Report or block dvliman

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View protobuf-readme.md
View spacemacs-cheshe.md

Useful Spacemacs commands

  • SPC q q - quit
  • SPC w / - split window vertically
  • SPC w - - split window horizontally
  • SPC 1 - switch to window 1
  • SPC 2 - switch to window 2
  • SPC w c - delete current window
  • SPC TAB - switch to previous buffer
  • SPC b b - switch buffers
@dvliman
dvliman / borg-backup-enhanced.sh
Created Mar 26, 2019 — forked from anthonyclarka2/borg-backup-enhanced.sh
Borg backup script with exit code checking and status push to Zabbix
View borg-backup-enhanced.sh
#!/bin/sh
# Enhanced backup script
# Sends messages to Zabbix based on exit code of borg executable
#
# anthonyclark AT G MAIL
# Shellcheck will still kvetch at you if notices are enabled
#
# This script will not work AS-IS but is only provided as such
# NO WARRANTIES
# This work is licensed under a Creative Commons Attribution 4.0 International License.
View curl.sh
curl -XPOST -H "Content-Type: application/json" http://localhost:8080/api/users/create -d '{"name": "david", "email": "david@david.com"}'
{"user_id":4}
// => onErrorResume { }
curl -XPOST -H "Content-Type: application/json" http://localhost:8080/api/users/create -d '{"name": "david", "email": "david@david.com"}'
{"error":{"code":"users-create-failed","msg":"ERROR: duplicate key value violates unique constraint \"users_email_key\"\n Detail: Key (email)=(david@david.com) already exists."}}
// => fetch found
curl -XPOST -H "Content-Type: application/json" http://localhost:8080/api/users/fetch -d '{"user_id": 4}'
{"user_id":4,"name":"david","email":"david@david.com"}
View Router.kt
package com.dvliman.demo
// src/main/kotlin/com/dvliman/Router.kt
import com.dvliman.demo.user.UserHandler
import org.springframework.context.annotation.Bean
import org.springframework.http.MediaType.APPLICATION_JSON
import org.springframework.stereotype.Component
import org.springframework.web.reactive.function.server.router
View UserHandler.kt
// src/main/kotlin/com/dvliman/user/UserHandler
package com.dvliman.demo.user
import org.springframework.http.HttpStatus
import org.springframework.http.MediaType.APPLICATION_JSON
import org.springframework.web.bind.annotation.RestController
import org.springframework.web.reactive.function.server.ServerRequest
import org.springframework.web.reactive.function.server.ServerResponse
import reactor.core.publisher.Mono
View UserRepo.kt
// src/main/kotlin/com/dvliman/demo/user/UserRepo.kt
package com.dvliman.demo.user
import org.davidmoten.rx.jdbc.Database
import org.davidmoten.rx.jdbc.Parameter
import org.springframework.stereotype.Component
import reactor.core.publisher.Mono
import reactor.core.publisher.Flux
import reactor.core.publisher.toFlux
View UserModels.kt
// src/main/kotlin/com/dvliman/demo/user/UserModels.kt
package com.dvliman.demo.user
import org.springframework.web.reactive.function.server.ServerResponse
import org.springframework.http.MediaType.APPLICATION_JSON
import reactor.core.publisher.Mono
data class User(
val user_id: Int,
View application.properties
// src/main/resources/application.properties
demo.db.url = jdbc:postgresql://localhost/demo
View Beans.kt
// src/main/kotlin/com/dvliman/demo/Beans.kt
package com.dvliman.demo
import org.davidmoten.rx.jdbc.Database
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
@Configuration
class Beans {
You can’t perform that action at this time.