Skip to content

Instantly share code, notes, and snippets.

View opyate's full-sized avatar
🐠
Fishing.

Juan M Uys opyate

🐠
Fishing.
View GitHub Profile
@opyate
opyate / somehost.conf
Last active December 15, 2015 18:09 — forked from tomkersten/somehost.conf
upstream your-app {
# fail_timeout=0 means we always retry an upstream even if it failed
# to return a good HTTP response (in case the Unicorn master nukes a
# single worker for timing out).
server unix:/tmp/your_app.socket fail_timeout=0;
}
server {
listen 80;
function sendTestLead() {
callAjax("servlet/SendTestLead?order_id=165&product_id=1", alert);
}
function callAjax(url, f) {
var o = new Object();
o.req = makeXMLHttpRequest();
o.req.onreadystatechange = function() {
if(o.req.readyState == 4)
f(o.req.responseText);
update-alternatives --install /usr/bin/java java ${JAVA_HOME}/bin/java 50
!!:gs/java/jar/
!!:gs/jar/javac/
!!:gs/javac/javah/
!!:gs/javah/javap/
!!:gs/javap/javaws/
!!:gs/javaws/jconsole/
!!:gs/jconsole/jhat/
!!:gs/jhat/jinfo/
!!:gs/jinfo/jmap/
@opyate
opyate / catserver
Last active December 21, 2015 22:29
time cat lolcat.jpg | nc -l 9999
Welcome to Scala version 2.10.2 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_21).
Type in expressions to have them evaluated.
Type :help for more information.
scala> import shapeless._
import shapeless._
scala> import syntax.std.tuple._
import syntax.tuple._
#
# Wide-open CORS config for nginx
#
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
#
object Meh {
def `(╯°□°)╯︵ ┻━┻` {
throw new RuntimeException("Screw this.")
}
}
@opyate
opyate / fix-wifi-issues
Created November 2, 2013 07:30
If you run Ubuntu 12.4, run this command right now.
sudo apt-get install --install-recommends \
linux-generic-lts-quantal \
xserver-xorg-lts-quantal \
libgl1-mesa-glx-lts-quantal
@opyate
opyate / Explanation.md
Last active December 14, 2018 16:38
The gist behind Project Euler 18 and 67.

The voila moment came for me when I realised I had to seed the fold computation with the base layer in the triangle.

The triangle is represented as a nested list, like so: List(List(1), List(2, 3), List(4, 5, 6)) and so forth.


     1
    / \
   2   3
 / \ / \
#!/bin/bash
sudo apt-get install openjdk-7-jdk curl
[[ -e sbt-launch.jar ]] || curl -L -o sbt-launch.jar http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt-launch/0.13.1/sbt-launch.jar
if [ -e dummy ] ; then
echo "dummy project exists"
else
mkdir -p dummy/project
echo 'sbt.version=0.13.1' > dummy/build.properties
echo 'object MyApp extends App { println("hello sbt") }' > dummy/MyApp.scala