This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
netstat -tulpn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
maintainer in Docker := "Aleksandar Stojadinovic ([email protected])" | |
dockerBaseImage := "anapsix/alpine-java:8" | |
packageName in Docker := "data-web-service" | |
dockerRepository := Some("example.com/foobar") | |
dockerUpdateLatest := true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class JHtmlEscapingFlask(Flask): | |
def select_jinja_autoescape(self, filename): | |
if filename is None: | |
return False | |
if filename.endswith('.jinja2'): | |
return True | |
return Flask.select_jinja_autoescape(self, filename) | |
app = JHtmlEscapingFlask(__name__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Use ext4 | |
2. Add "noatime" to each Linux SSD volume in /etc/fstab like so: | |
/dev/sda1 / ext4 defaults,noatime 0 1 | |
UUID=xxxxx / ext4 noatime,errors=remount-ro 0 1 | |
3. Set up TRIM | |
A trim command (known as TRIM in the ATA command set, and UNMAP in the SCSI command set) allows an operating system to inform a solid-state drive (SSD) which blocks of data are no longer considered in use and can be wiped internally. | |
TRIM can be executed daily, weekly or monthly. To set up when should it be executed, copy /etc/cron.weekly/fstrim to the appropriate /etc/cron.[weekly|daily|monthly] directory. *Note to myself* keep it at weekly, it's fine enough. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Set `listen_addres`s to `*` in `/etc/postgres/<version>/main/ | |
postgresql.conf`, or specify a concrete interface. | |
2. Add permissions to `/etc/postgres/<version>/main/pg_hba` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bashScriptExtraDefines += """addJava "-Dmode=prod"""" | |
bashScriptExtraDefines += "addJava -Dlogdir=$app_home/../logs/" | |
bashScriptConfigLocation := Some("$app_home/conf/prod.conf") | |
mainClass in Compile := Some("sample.hello.Main") | |
mappings in Universal += file("src/main/resources/base.conf") -> "conf/base.conf" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sources in (Compile, doc) := Seq.empty | |
publishArtifact in (Compile, packageDoc) := false | |
//Additional JPA configuration | |
PlayKeys.externalizeResources := false | |
mappings in Universal += file("conf/base.conf") -> "conf/base.conf" | |
mappings in Universal += file("conf/prod.conf") -> "conf/prod.conf" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math._ | |
import scala.util._ | |
object Solution extends App { | |
def spanAndEncode(message : String) : String = | |
{ | |
val (same, rest) = message.span(_ == message.head) | |
val output = new StringBuilder | |
output ++= ("0" * (2 - same.head.asDigit)) + " " + ("0" * same.length) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Source: http://www.sysmic.org/dotclear/index.php?post/2010/03/24/Convert-keys-betweens-GnuPG%2C-OpenSsh-and-OpenSSL | |
# OpenSSH private keys are directly understable by OpenSSL. You can test for example: | |
openssl rsa -in ~/.ssh/id_rsa -text | |
openssl dsa -in ~/.ssh/id_dsa -text | |
# So, you can directly use it to create a certification request: | |
openssl req -new -key ~/.ssh/id_dsa -out myid.csr | |
# You can also use your ssh key to create a sef-signed certificate: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Debian/Ubuntu | |
sudo apt-add-repository ppa:webupd8team/java | |
sudo apt-get update | |
sudo apt-get install oracle-java8-installer | |
# CentOS: | |
sudo wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" \ | |
"http://download.oracle.com/otn-pub/java/jdk/8u25-b17/jdk-8u25-linux-x64.tar.gz" |
NewerOlder