Skip to content

Instantly share code, notes, and snippets.

View krasio's full-sized avatar
🎣
Gone fishing

Krasimir Angelov krasio

🎣
Gone fishing
View GitHub Profile
tasks=# BEGIN;
BEGIN
tasks=# SELECT * FROM tasks WHERE status = 'pending' ORDER BY created_at ASC LIMIT 1 FOR UPDATE SKIP LOCKED;
id | status | payload | created_at
----+---------+-------------------------------------------------------------------+----------------------------
1 | pending | { "action": "feed", "animal": "panda", "food": "kaiserschmarrn" } | 2019-09-19 15:39:49.459537
(1 row)
tasks=# SAVEPOINT task_1;
Steps to recreate http://blog.codingspree.net/posts/learning-bosh-deploying-web-application/
# In your BUCC folder:
bucc $ bin/bucc up
bucc $ bin/bucc env > bucc.env
bucc $ source bucc.env
bucc $ bosh update-cloud-config ~/projects/bucc/src/bosh-deployment/warden/cloud-config.yml
bucc $ bosh upload-stemcell --sha1 9190e1d20dcb937e007abbb4054e19b1daa8d0a4 \
https://bosh.io/d/stemcells/bosh-warden-boshlite-ubuntu-xenial-go_agent?v=170.14
# In your BUCC folder:
bucc $ bin/bucc up
bucc $ bin/bucc env > bucc.env
bucc $ source bucc.env
bucc $ bosh update-cloud-config ~/projects/bucc/src/bosh-deployment/warden/cloud-config.yml
bucc $ bosh upload-stemcell --sha1 9190e1d20dcb937e007abbb4054e19b1daa8d0a4 \
https://bosh.io/d/stemcells/bosh-warden-boshlite-ubuntu-xenial-go_agent?v=170.14
$ git clone https://github.com/krasio/akoranga-nginx-boshrelease.git
$ cd akoranga-nginx-boshrelease
$ bucc up
Using flags: --cpi virtualbox --lite
Flag files: '/Users/qrasio/projects/bucc/state/{cpi,lite,flags}'
Deployment manifest: '/Users/qrasio/projects/bucc/src/bosh-deployment/bosh.yml'
Deployment state: '/Users/qrasio/projects/bucc/state/state.json'
Started validating
Downloading release 'bosh'... Skipped [Found in local cache] (00:00:00)
Validating release 'bosh'... Finished (00:00:00)
0
@krasio
krasio / poolboy_demo.ex
Created March 18, 2016 09:51 — forked from henrik/poolboy_demo.ex
Example of using Poolboy in Elixir to limit concurrency (e.g. of HTTP requests).
defmodule HttpRequester do
use GenServer
def start_link(_) do
GenServer.start_link(__MODULE__, nil, [])
end
def fetch(server, url) do
# Don't use cast: http://blog.elixirsips.com/2014/07/16/errata-dont-use-cast-in-a-poolboy-transaction/
timeout_ms = 10_000
#!/usr/bin/env ruby
require 'socket'
test_file = ARGV[0]
socket = UNIXSocket.new('testing.sock')
socket.write(test_file)
socket.close_write
[alias]
tree = log --all --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset %Cblue%an%Creset' --abbrev-commit --date=relative
@krasio
krasio / custom.conf.erb
Created October 30, 2012 08:40
Simple Chef recipe to customize Nginx configuration on Engine Yard App Cloud
# cookbooks/nginx-custom/templates/default/custom.conf.erb
rewrite ^/members/(.*)/blog_entries/(.*)$ /members/$1/blog/$2 permanent;
@krasio
krasio / redis_on_passenger.rb
Created July 24, 2012 13:28
config/initializers/redis_on_passenger.rb
# config/initializers/redis_on_passenger.rb
if defined?(PhusionPassenger)
PhusionPassenger.on_event(:starting_worker_process) do |forked|
# We're in smart spawning mode.
if forked
# Re-establish redis connection
# disconnect
Resque.redis.client.disconnect