Skip to content

Instantly share code, notes, and snippets.

View mieciu's full-sized avatar

Przemysław Hejman mieciu

View GitHub Profile
@mieciu
mieciu / docs.md
Created April 24, 2024 13:45
My public EAP doc

Install Pulumi

In the telemetry collector we're using Pulumi for IaaC. To install Pulumi, run the following command:

brew install pulumi/tap/pulumi

Then go to infra dir and deploy with pulumi up command. Pulumi requires you to be authenticated against the Google Cloud Platform. To authenticate, run the following command:

gcloud auth application-default login
@mieciu
mieciu / script.r
Last active March 6, 2016 17:37
K-means in R
install.packages("plot3D")
library(jpeg)
library(rgl)
img <- readJPEG("akira2.jpg")
# > dim(img)
# [1] 514 694 3 <height width RGB>
# load image into data frame
pixels_df <- data.frame(r=as.vector(img[,,1]),g=as.vector(img[,,2]),b=as.vector(img[,,3]))
@mieciu
mieciu / gist:df4ed74fed4b98f77371
Created July 16, 2015 15:34
Python TCP and UDP sockets within context manager
import socket
from contextlib import contextmanager
@contextmanager
def tcp_connection_to(*args, **kwargs):
s = socket.create_connection(*args, **kwargs)
yield s
s.close()
@mieciu
mieciu / gist:0cff51ac7796ad6da43a
Last active August 29, 2015 14:24
Hosted graphite low-level but elegant feeding
from contextlib import contextmanager
import socket
import os
HOSTED_GRAPHITE = ("carbon.hostedgraphite.com", 2003)
API_KEY = "ASDFASDF"
metric_name = "mieciu.head.request"
metric_value = 140
git_diff.each_delta do | delta |
if delta.new_file[:path] =~ /migrations/ or delta.old_file[:path] =~ /migrations/
puts "There are migrations, aborting..."
end
end
---
- hosts: all
connection: local
vars:
install_flask: False
name: example1
tasks:
- name: Check ssh config
file: path=/home/jan/test_file owner=”jan" mode="0600"
@mieciu
mieciu / plik.pp
Last active August 29, 2015 14:03
class ntp {
case $::operatingsystem {
'CentOS', 'Redhat': {
$service_name = 'ntpd'
$conf_file = 'ntp.conf.el'
}
'Debian', 'Ubuntu': {
$service_name = 'ntp'
$conf_file = 'ntp.conf.debian'
}
package "build-essential" do
action :install
end
bash "compile_redis_source" do
cwd Chef::Config[:file_cache_path]
code <<-EOH
tar zxf redis.tar.gz
cd antirez-redis-55479a7
make && make install
@mieciu
mieciu / gist:7230775
Created October 30, 2013 11:01
A gist test
import socket
import struct
import traceback
print "Jestem testem"