Skip to content

Instantly share code, notes, and snippets.

# create instance using https://aws.amazon.com/marketplace/fulfillment?productId=b7ee8a69-ee97-4a49-9e68-afaee216db2e&launch=oneClickLaunch
# use west-2b (us oregon, subnet-5d371e38)
# create swap (https://meta.discourse.org/t/create-a-swapfile-for-your-linux-server/13880)
sudo install -o root -g root -m 0600 /dev/null /swapfile
dd if=/dev/zero of=/swapfile bs=1k count=2048k
mkswap /swapfile
swapon /swapfile
echo "/swapfile swap swap auto 0 0" | sudo tee -a /etc/fstab
sudo sysctl -w vm.swappiness=10
@spaced
spaced / togglReport.sc
Last active June 29, 2017 19:23
TogglReport
#! /usr/local/bin/amm
/**
* A ammonite script http://www.lihaoyi.com/Ammonite/#Ammonite-Shell
* For report toggl datas
* HowTo:
* - install ammonite: sudo curl -L -o /usr/local/bin/amm https://git.io/vHaMa && sudo chmod +x /usr/local/bin/amm
* - update script with Toggl-apikey and
* - chmod +x togglReport.sc
* - ./togglReport.sc
*
@spaced
spaced / GoogleAnalytics.scala
Last active May 25, 2016 04:48
Small Scalajs facade for google analytics events
object EventTracker {
def isScriptLoaded=js.Dynamic.global.ga.isInstanceOf[js.Function]
def sendEvent(category:String,action:String,label:String):Unit={
if (isScriptLoaded) GoogleAnalytics.ga("send","event",category,action,label)
}
def sendEvent(category:String,action:String,label:String,value:String):Unit={
if (isScriptLoaded) GoogleAnalytics.ga("send","event",category,action,label,value)
}
}