Skip to content

Instantly share code, notes, and snippets.

View Dnomyar's full-sized avatar

Damien RAYMOND Dnomyar

View GitHub Profile
@Ryanb58
Ryanb58 / install.md
Last active June 25, 2024 19:59
How to install telnet into a alpine docker container. This is useful when using the celery remote debugger in a dev environment.
>>> docker exec -it CONTAINERID /bin/sh
/app # telnet
/bin/sh: telnet: not found

/app # apk update
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz
v3.7.0-243-gf26e75a186 [http://dl-cdn.alpinelinux.org/alpine/v3.7/main]
v3.7.0-229-g087f28e29d [http://dl-cdn.alpinelinux.org/alpine/v3.7/community]
@daniel-trinh
daniel-trinh / prettyPrint.scala
Last active November 11, 2016 09:39
Pretty Print method for formatting case class (as a string input)
def pp(tree: String, indentSize: Int = 2): String = {
var indentLevel = 0
var outputTree = ""
tree foreach { char => char match {
case '(' =>
indentLevel += 1
outputTree += char.toString+'\n'+indents
case ')' =>
indentLevel -= 1
outputTree += "\n" + indents + char.toString
@mandubian
mandubian / CODE.scala
Last active December 14, 2015 09:29 — forked from zxamplez/CODE
#Play2.1 #Json Read 2 fields exclusively (accepts only one present) essaimodif #scala #nullable
import play.api.libs.json._
import play.api.libs.functional.syntax._
val r = (
(__ \ "field1").readNullable[String] and
(__ \ "field2").readNullable[Int]
).tupled.filter(ValidationError("unexpected result")){
case( Some(x), None ) => true;
case ( None, Some(x) ) => true;
case _ => false
@marklister
marklister / BaseN.scala
Last active September 20, 2020 23:40
Scala Hex / Decimal / Binary calculator / DSL
/**
* Scala hex / decimal binary calculator
* (c) Mark Lister 2012
* Licence Apache 2.
*/
class BaseN(b: BigInt, val baseN: Int) extends BigInt(b.underlying) {
def n(x: Int) = new BaseN(b, x)
/**
@guillaumebort
guillaumebort / 1.sql
Created May 25, 2012 15:17
Play 2.0/Anorm
# --- !Ups
CREATE TABLE users(
email VARCHAR(255) NOT NULL PRIMARY KEY,
name VARCHAR(255)
);
CREATE TABLE subjects(
id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
title LONGTEXT NOT NULL,