Skip to content

Instantly share code, notes, and snippets.

@netj
netj / memusg
Last active June 25, 2024 17:39
memusg -- Measure memory usage of processes
#!/usr/bin/env bash
# memusg -- Measure memory usage of processes
# Usage: memusg COMMAND [ARGS]...
#
# Author: Jaeho Shin <netj@sparcs.org>
# Created: 2010-08-16
############################################################################
# Copyright 2010 Jaeho Shin. #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); #
@seratch
seratch / build.sbt
Created March 8, 2012 03:06
Using Anorm 2.0 without Play Framework
scalaVersion := "2.9.1"
resolvers += "typesafe" at "http://repo.typesafe.com/typesafe/releases"
libraryDependencies ++= Seq(
"play" %% "anorm" % "2.0-RC4",
"com.github.seratch" %% "scalikejdbc" % "[0.5,)",
"org.hsqldb" % "hsqldb" % "[2,)"
)
@hamidreza-s
hamidreza-s / PHP - Hide X-Powered-By.ini
Created January 8, 2013 12:21
Hide X-Powered-By field name from HTTP Response. Go to expose_php directive in php.ini file and set it to Off.
expose_php = Off
@javierfs89
javierfs89 / Strip.scala
Created June 9, 2014 11:27
StripMargin string interpolator macro
/**
* This interpolator can be evaluated in compile time, so you can use to generate
* constant strings (if all params are also constant)
*
* Works on Scala 2.10.2
*/
implicit class stripInterpolator(sc: StringContext) {
def strip(params: Any*) = macro stripMacro
}
@fadhlirahim
fadhlirahim / installing_supervisor_macosx.md
Last active December 31, 2023 14:45
Setting up supervisord in Mac OS X

Installation

Installing Supervisor on OS X is simple:

sudo pip install supervisor

This assumes you have pip. If you don't:

@jrudolph
jrudolph / TestMultipartFileUpload.scala
Last active February 13, 2023 18:09
akka-http Multipart file-upload client + server example
package akka.http.scaladsl
import java.io.File
import akka.http.scaladsl.unmarshalling.Unmarshal
import akka.util.ByteString
import scala.concurrent.duration._
import akka.actor.ActorSystem
@cb372
cb372 / jargon.md
Last active May 14, 2024 03:45
Category theory jargon cheat sheet

Category theory jargon cheat sheet

A primer/refresher on the category theory concepts that most commonly crop up in conversations about Scala or FP. (Because it's embarassing when I forget this stuff!)

I'll be assuming Scalaz imports in code samples, and some of the code may be pseudo-Scala.

Functor

A functor is something that supports map.

@pchiusano
pchiusano / error.log
Created September 3, 2015 19:12
Epic compile error from Scala
> compile
[info] Compiling 1 Scala source to /Users/pchiusano/Dropbox/projects/scalaz-stream/target/scala-2.11/classes...
[error] /Users/pchiusano/Dropbox/projects/scalaz-stream/src/main/scala/streams/Process1.scala:27: polymorphic expression cannot be instantiated to expected type;
[error] found : [F(in method run)(in method run)(in method run)(in method run)(in method run)(in method run)(in method run)(in method run)[_], I2(in method run)(in method run)(in method run)(in method run)(in method run)(in method run)(in method run)(in method run) <: I]streams.Stream.Handle[F(in method run)(in method run)(in method run)(in method run)(in method run)(in method run)(in method run)(in method run),I] => streams.Pull[F(in method run)(in method run)(in method run)(in method run)(in method run)(in method run)(in method run)(in method run),O,streams.Stream.Handle[F(in method run)(in method run)(in method run)(in method run)(in method run)(in method run)(in method run)(in method run),I2(in method run)(in method run)(in
@saeidzebardast
saeidzebardast / youtube-dl-playlist
Last active April 29, 2022 16:12
Download Youtube playlist in a folder and indexing videos using youtube-dl
alias youtube-dl-playlist="youtube-dl --ignore-errors --output '%(playlist)s/%(playlist_index)s- %(title)s.%(ext)s'"
@lihaoyi
lihaoyi / play.scala
Last active April 18, 2017 08:18
play.scala
/**
* Single-file play framework application! Make sure everything
* works, as this is the test case that un-earthed #371
*/
load.ivy("com.typesafe.play" %% "play" % "2.5.0")
load.ivy("com.typesafe.play" %% "play-netty-server" % "2.5.0")
load.ivy("org.scalaj" %% "scalaj-http" % "2.2.1")
@