Skip to content

Instantly share code, notes, and snippets.

Avatar
🎣
Gone fishing

Krasimir Angelov krasio

🎣
Gone fishing
View GitHub Profile
View gist:761da3829988f3be1e371578ec6cef40
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;
View gist:a07c91f46c29a10f696ddee309e449a5
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
View gist:f3e1cd072be3fc024b373e555b7af61b
# 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
View gist:eddc4b17795fc5be80f1caa500a1052c
$ 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)
@krasio
krasio / poolboy_demo.ex
Created Mar 18, 2016 — forked from henrik/poolboy_demo.ex
Example of using Poolboy in Elixir to limit concurrency (e.g. of HTTP requests).
View poolboy_demo.ex
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
View tclient.rb
#!/usr/bin/env ruby
require 'socket'
test_file = ARGV[0]
socket = UNIXSocket.new('testing.sock')
socket.write(test_file)
socket.close_write
View .gitconfig
[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 Oct 30, 2012
Simple Chef recipe to customize Nginx configuration on Engine Yard App Cloud
View custom.conf.erb
# cookbooks/nginx-custom/templates/default/custom.conf.erb
rewrite ^/members/(.*)/blog_entries/(.*)$ /members/$1/blog/$2 permanent;
@krasio
krasio / redis_on_passenger.rb
Created Jul 24, 2012
config/initializers/redis_on_passenger.rb
View 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