Skip to content

Instantly share code, notes, and snippets.

View fxposter's full-sized avatar

Pavlo fxposter

View GitHub Profile
@fxposter
fxposter / bash.sh
Last active February 3, 2023 20:12
Docker with docker-compose for lima-vm
# now you can do
# alias docker="limactl shell docker docker"
# and run
# docker run --rm ubuntu
# port forwarding and volume mounting would work out out of the box
# docker run --rm -p 8080:80 -v `pwd`:/usr/share/nginx/html nginx
@fxposter
fxposter / go.mod
Created September 7, 2020 20:55
envoy control plane
module example.com/envoy-cp
go 1.14
require (
github.com/envoyproxy/go-control-plane v0.9.5
github.com/golang/protobuf v1.3.2
google.golang.org/grpc v1.25.1
)
require 'thread'
class Test
def initialize(queue)
@queue = queue
end
def run
value = nil
while value = @queue.pop
@fxposter
fxposter / node->pod.txt
Created July 10, 2016 08:54
coreos-kubernetes
node->pod (works)
Taken from node:
[root@w1 ~]# tcpdump -vv -i flannel.1
tcpdump: listening on flannel.1, link-type EN10MB (Ethernet), capture size 262144 bytes
08:50:29.430554 IP (tos 0x0, ttl 64, id 24079, offset 0, flags [DF], proto TCP (6), length 60)
w1.49866 > 10.2.58.2.http: Flags [S], cksum 0x7234 (incorrect -> 0xdab7), seq 1767611758, win 28200, options [mss 1410,sackOK,TS val 443233 ecr 0,nop,wscale 7], length 0
08:50:29.431862 IP (tos 0x0, ttl 63, id 0, offset 0, flags [DF], proto TCP (6), length 60)
10.2.58.2.http > w1.49866: Flags [S.], cksum 0x03c1 (correct), seq 3687243300, ack 1767611759, win 27960, options [mss 1410,sackOK,TS val 400868 ecr 443233,nop,wscale 7], length 0

chef-server-ctl cleanse

apt-get purge -y chef-server apt-get purge -y chef-server-core

rm -rf /etc/opscode /etc/chef-server /opt/chef-server /opt/opscode /var/opt /var/log/chef-server

dpkg -i chef-server_11.0.11-1.ubuntu.11.04_amd64.deb

chef-server-ctl reconfigure

@fxposter
fxposter / net-http-keepalive-without-block.rb
Created October 28, 2015 10:50
Net/HTTP with keep-alive, but without block
http = Net::HTTP.new(uri.host, uri.port)
http.start
request1 = Net::HTTP::Get.new(uri1)
response1 = http.request(request1)
request2 = Net::HTTP::Get.new(uri2)
response2 = http.request(request2)
http.finish
@fxposter
fxposter / gist:78a088533b0cee1ccb11
Created October 23, 2015 13:33
slim-ruby mysql error
Step 2 : RUN ! find /usr/local/bundle -iname '*.so' | xargs -I {} ldd {} | grep 'not found'
---> Running in 464610a57692
libmysqlclient.so.18 => not found
libmysqlclient.so.18 => not found
libmysqlclient.so.18 => not found
2015/10/23 16:02:08 Failed to process json stream error: The command '/bin/sh -c ! find /usr/local/bundle -iname '*.so' | xargs -I {} ldd {} | grep 'not found'' returned a non-zero code: 1
@fxposter
fxposter / base.rb
Created October 22, 2015 11:19
Default Rails template
# rails new app_name -d mysql --skip-bundle -m path/to/this/template.rb
comment_lines 'Gemfile', "gem 'turbolinks'"
comment_lines 'Gemfile', "gem 'jbuilder'"
comment_lines 'Gemfile', "gem 'sass-rails'"
comment_lines 'Gemfile', "gem 'coffee-rails'"
comment_lines 'Gemfile', "gem 'uglifier'"
comment_lines 'Gemfile', "gem 'sdoc'"
gsub_file 'Gemfile', "gem 'mysql2'", "gem 'mysql2', '~> 0.3.20'"
@fxposter
fxposter / hacking-chef.rb
Created October 20, 2015 19:57
Hacking Chef
@chef.eval_and_check_for_changes do |frame|
template "/etc/default/#{service_id}" do
source "service.erb"
variables :name => service_id, :port => frame.eval{@service.port}
mode 0755
end
end
@fxposter
fxposter / chef-docker.rb
Created October 20, 2015 12:03
Docker logrotate in chef recipe
logrotate_app 'docker' do
path ['/var/lib/docker/containers/*/*.log', '/var/log/docker.log']
rotate 30
frequency 'daily'
options %w[notifempty missingok compress delaycompress copytruncate]
end