Skip to content

Instantly share code, notes, and snippets.

@arkadijs
arkadijs / params.rb
Created February 20, 2014 10:43
How to write this nicely?
def f(params)
puts params
end
opt = {}
opt[:config] = 1
f (:p1 => 'x', :p2 => ( [{ :r => 'const', :t => opt[:config] }] if opt[:config] ))
# {:p1=>"x", :p2=>[{:r=>"const", :t=>1}]}
@arkadijs
arkadijs / _README.md
Last active August 29, 2015 13:57
Hackathon: Write your own dynamic language today - with PyPy http://ldn.lv/events/141429062 http://goo.gl/rdS0dz

PyPy environment

Download and build PyPy as described here. It will take about 1 hour of modern machine time. The pre-built PyPy archive does not have all the stuff we need.

Instead, I supply you with a powerful Linux VM in case you choose to work in the cloud:

$ ssh hacker01@pypy-workshop.hosting.lv

pypy binary is in your PATH. And PYPY env var is also set to the path of unpacked and already built PyPy sources.

@arkadijs
arkadijs / _README.md
Last active January 9, 2021 14:21
Workshop: Deploying WordPress on Google App Engine :: PHP and Cloud SQL http://ldn.lv/events/166755872 http://goo.gl/F5K4Qn

Google Cloud SDK

There are two alternatives to start with the SDK:

  1. install SDK locally;
  2. use provided Linux VM in the cloud via ssh.

Note: everyone will get a separate index, ie. hacker02, hacker03, etc.

$ ssh hacker01@wp-workshop.hosting.lv

java ee (v1.4, and partly 5) cf / bosh
(proprietary) deployment descriptor bosh manifest
xml yaml
ear(-s) bosh release
ee app server, "fits all purposes" cloudfoundry elastic runtime
transparent clustering, availability multi-az deployment, resurrector
statefull stateless

j2ee ship sunk ~9 years ago.

@arkadijs
arkadijs / compute.groovy
Last active August 29, 2015 14:05
Authentication to Google Compute Engine example
// compile 'com.github.groovy-wslite:groovy-wslite:1.1.0'
// compile 'com.google.apis:google-api-services-compute:v1-rev29-1.19.0'
// compile 'com.google.http-client:google-http-client-jackson2:1.19.0'
// compile 'com.google.oauth-client:google-oauth-client-jetty:1.19.0'
import com.google.api.services.compute.Compute
import com.google.api.services.compute.model.*
import wslite.rest.ContentType
import wslite.http.HTTPClient
import wslite.rest.RESTClient
@arkadijs
arkadijs / install.md
Last active January 6, 2022 17:10
GitLab in LXC on Ubuntu and openSUSE

Ubuntu host and container

Install LXC:

apt-get install linux-hwe-generic # update to 3.13 on Precise
apt-add-repository ppa:ubuntu-lxc/stable
apt-get update
apt-get install lxc lxc-templates cgmanager cgroup-lite
reboot

Docker

Docker-enabled environment

Cloud

ssh -i workshop.pem ubuntu@lxc-1-01.eu.r53.acp.io

Replace 01 in lxc-1-01 with index assigned to you. Download workshop key below.

@arkadijs
arkadijs / sse.scala
Last active August 29, 2015 14:09
Server-sent events in Play2 / Iteratee for Hystrix console
import play.api.libs.concurrent._
import play.api.libs.concurrent.Execution.Implicits._
import play.api.libs.iteratee._
import scala.concurrent.duration._
def circuitBreakers = Action {
Ok.stream(Enumerator.generateM {
val promise = Promise[String]()
Akka.system.scheduler.scheduleOnce(1 second) {
promise.completeWith(circuitBreakers)
@arkadijs
arkadijs / _README.md
Last active August 29, 2015 14:09
Global Day of Coderetreat 2014, Riga, Latvia http://ldn.lv/events/209047582
@arkadijs
arkadijs / pypy-bootstrap.sh
Created November 23, 2014 20:29
PyPy bootstrap from sources on Debian
#!/bin/sh
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install -y \
gcc g++ make python-dev libffi-dev libsqlite3-dev pkg-config \
libz-dev libbz2-dev libncurses-dev libexpat1-dev \
libssl-dev libgc-dev python-sphinx python-greenlet \
time less htop bzip2 unzip zip git mercurial nano rsync vim
sudo apt-get clean
wget https://bitbucket.org/pypy/pypy/downloads/pypy-2.2.1-src.tar.bz2