Skip to content

Instantly share code, notes, and snippets.

View j4zzcat's full-sized avatar

Sharon Dagan j4zzcat

View GitHub Profile
@j4zzcat
j4zzcat / Wish list
Last active June 7, 2022 18:54
Must-use frameworks/modules/apps for my next project
Frameworks and libs
-------------------
Spring boot (duh)
Resilience4j https://github.com/resilience4j/resilience4j
Picocli - https://picocli.info
Jackson - https://github.com/FasterXML/jackson
Zipkin
SaaS offerings
--------------
@j4zzcat
j4zzcat / install-nr-infra-es.sh
Created April 4, 2022 10:52
Installation script for New Relic infra agent and the Elasticsearch integration
# run this on ES master(s) and data nodes
# no need to install on the so call 'client' nodes
# assuming ubuntu 16.04 and up
# assuming that curl, gnupg2, sudo and systemctl are already installed and configured (default for ubuntu)
# config
NR_LICENSE_KEY="YOUR LICENSE KEY HERE"
ES_ENV="prod"
ES_NAME="my-es-cluster"
ES_USERNAME=""
@j4zzcat
j4zzcat / Dockerfile
Created April 19, 2021 06:27
Set timezone in Ubuntu docker container
FROM ubuntu:20.04
# Set TZ to Asia/Jerusalem
# For valid combinations, run 'dpkg-reconfigure -f noninteractive tzdata'
RUN export DEBIAN_FRONTEND=noninteractive \
&& export DEBCONF_NONINTERACTIVE_SEEN=true \
&& echo 'tzdata tzdata/Areas select Asia' | debconf-set-selections \
&& echo 'tzdata tzdata/Zones/Asia select Jerusalem' | debconf-set-selections \
&& apt-get update -y \
&& apt-get install -y --no-install-recommends tzdata
@j4zzcat
j4zzcat / Terraform crash report
Created April 18, 2020 02:23
Terraform crash report
This file has been truncated, but you can view the full file.
2020/04/18 02:15:47 [INFO] Terraform version: 0.12.24
2020/04/18 02:15:47 [INFO] Go runtime version: go1.12.13
2020/04/18 02:15:47 [INFO] CLI args: []string{"/usr/local/bin/terraform", "apply", "-auto-approve", "-target=module.security_groups", "-target=module.network_server", "-target=module.installation_server", "-target=module.haproxy_masters", "-target=module.haproxy_workers", "-target=module.master_1", "-target=module.master_2", "-target=module.master_3", "-target=null_resource.nameserver_configuration"}
2020/04/18 02:15:47 [DEBUG] Attempting to open CLI config file: /root/.terraformrc
2020/04/18 02:15:47 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2020/04/18 02:15:47 [DEBUG] checking for credentials in "/root/.terraform.d/plugins"
2020/04/18 02:15:47 [INFO] CLI command args: []string{"apply", "-auto-approve", "-target=module.security_groups", "-target=module.network_server", "-target=module.installation_server", "-target=module.haproxy_masters", "-target=module.haproxy_workers", "-targe
@j4zzcat
j4zzcat / mock_open.rb
Created February 3, 2020 14:11
Mock File#open and #read
require 'ostruct'
class SomeClass
def run( filename )
File.open filename, 'r' do | f |
puts f.read
end
end
end
@j4zzcat
j4zzcat / squigly_heredoc.rb
Created January 28, 2020 08:38
Remove white space from HEREDOC
class Subscription
def warning_message
<<~HEREDOC
Subscription expiring soon!
Your free trial will expire in #{days_until_expiration} days.
Please update your billing information.
HEREDOC
end
end
@j4zzcat
j4zzcat / pixie
Last active January 19, 2020 20:49
Dockerise a Ruby Gem
#!/usr/bin/env bash
GEM_NAME='pixie'
#
# Generic stuff
#
function fail {
local MESSAGE=${1}
@j4zzcat
j4zzcat / dnsmasq.conf
Last active January 30, 2022 01:00
Preseed file for network console installation, ubuntu 19.10
interface=eth1
bind-interfaces
domain=pxe.local
dhcp-range=eth1,192.168.100.51,192.168.100.55,255.255.255.0,8h
dhcp-option=3,192.168.100.2 # gateway
dhcp-option=6,192.168.100.2 # dns
enable-tftp
tftp-root=/srv/tftp
dhcp-vendorclass=BIOS,PXEClient:Arch:00000
dhcp-vendorclass=UEFI32,PXEClient:Arch:00006
@j4zzcat
j4zzcat / pixie.sh
Created December 25, 2019 21:28
Dockerise
#! /usr/bin/env bash
PROGRAM_HOME=$(realpath ${0} 2>/dev/null || cd "$(dirname "${0}")" ; pwd -P)/..
RUNTIME_TAG=pixie-runtime:1.0
function run_script {
CUT_LINE=$(cat ${0} | grep -n '#! dockerise ' | tail -1 | awk -F ':' '{print $1}')
tail +${CUT_LINE} ${0} | tail -n +2 | \
docker run --rm -i \
-v /var/run/docker.sock:/var/run/docker.sock \
r = %r{^/user/(?<user_id>.*)/login}
r.match '/user/1234/login' # => #<MatchData "/user/1234/login" user_id:"1234">