Skip to content

Instantly share code, notes, and snippets.

View boh717's full-sized avatar
👨‍💻
Coding

Alberto Coletta boh717

👨‍💻
Coding
View GitHub Profile
@boh717
boh717 / akka-(de)serializer.scala
Created February 24, 2020 16:38
Akka http (de)serializer for Map[String, Any]
implicit object AnyJsonFormat extends JsonFormat[Any] {
def write(x: Any) = x match {
case n: Int => JsNumber(n)
case s: String => JsString(s)
case x: Seq[_] => seqFormat[Any].write(x)
case m: Map[String, _] @unchecked => mapFormat[String, Any].write(m)
case b: Boolean if b => JsTrue
case b: Boolean if !b => JsFalse
case x =>
serializationError(
@boh717
boh717 / mysqldump.sh
Last active October 18, 2018 12:57 — forked from jakeasmith/mysqldump.sh
A quick snippet for doing a compressed mysql dump with a pv to monitor progress
# Add -h <host> -u <user> -p if needed
mysqldump --single-transaction --skip-lock-tables database [table1 table2 table3] | pv -W | gzip -c > [filename].sql.gz
@boh717
boh717 / update_ghost.sh
Last active July 27, 2020 08:58
Script to update self-hosted Ghost blog to its latest version
#!/bin/bash
KillNode() {
NODE_PID=`ps aux | grep [n]ode | awk '{print $2}'`
kill $NODE_PID 2>/dev/null
}
if [ -z $1 ]; then
echo "I need ghost version number as parameter."