Skip to content

Instantly share code, notes, and snippets.

View josacar's full-sized avatar
🐨
Koalified

Jose Luis Salas josacar

🐨
Koalified
View GitHub Profile
@josacar
josacar / cloudflare_audit_to_sumologic.rb
Last active June 19, 2019 12:58
Cloudflare audit logs to Sumologic
# frozen_string_literal: true
require 'net/http'
require 'json'
require 'uri'
module Environment
SUMOURL = ENV.fetch('SUMO_ENDPOINT')
ORGID = ENV.fetch('CLOUDFLARE_ORG_ID')
CLOUDFLAREAUTHEMAIL = ENV.fetch('CLOUDFLARE_AUTH_EMAIL')
@josacar
josacar / cloudflare_to_sumologic.rb
Created June 19, 2019 12:50
Cloudflare logs to Sumologic
# frozen_string_literal: true
require 'net/http'
require 'json'
require 'uri'
module Environment
SUMOURL = ENV.fetch('SUMO_ENDPOINT')
ZONEID = ENV.fetch('CLOUDFLARE_ZONE_ID')
CLOUDFLAREAUTHEMAIL = ENV.fetch('CLOUDFLARE_AUTH_EMAIL')
import java.net.*;
import java.io.*;
import javax.net.ssl.*;
public class SSLSocketClient {
public static void main(String[] args) throws Exception {
if (args.length != 2) {
System.out.println("Usage: "+SSLSocketClient.class.getName() +" <host> <port>");
System.exit(1);

Keybase proof

I hereby claim:

  • I am josacar on github.
  • I am josacar (https://keybase.io/josacar) on keybase.
  • I have a public key whose fingerprint is CB15 695E 5A2D 44DE 24C1 600C 41F1 16E6 926C 5673

To claim this, I am signing this object:

@josacar
josacar / check-memory-percent.sh
Created February 23, 2016 14:57
Check memory
#!/usr/bin/env bash
#
# Evaluate free system memory from Linux based systems based on percentage
# This was forked from Sensu Community Plugins
#
# Requires: awk
#
# Date: 2007-11-12
# Author: Thomas Borger - ESG
# Date: 2012-04-02
@josacar
josacar / gist:49effb09571d118f5bb9
Last active October 2, 2015 15:09
berkshelf error
rsions/0.10.0/download","dependencies":{"runit":">= 0.0.0","build-essential":">= 0.0.0"}},"0.12.1":{"location_type":"opscode","location_path":"https://supermarket.chef.io:443/api/v1","download_url":"https://supermarket.chef.io:443/api/v1/cookbooks/nginx/versions/0.12.1/download","dependencies":{"runit":">= 0.0.0","build-essential":">= 0.0.0"}},"0.14.0":{"location_type":"opscode","location_path":"https://supermarket.chef.io:443/api/v1","download_url":"https://supermarket.chef.io:443/api/v1/cookbooks/nginx/versions/0.14.0/download","dependencies":{"runit":">= 0.0.0","build-essential":">= 0.0.0"}},"0.14.1":{"location_type":"opscode","location_path":"https://supermarket.chef.io:443/api/v1","download_url":"https://supermarket.chef.io:443/api/v1/cookbooks/nginx/versions/0.1' (JSON::ParserError)
from vendor/bundle/ruby/2.2.0/gems/json-1.8.3/lib/json/common.rb:155:in `parse'
from vendor/bundle/ruby/2.2.0/gems/ridley-4.2.0/lib/ridley/middleware/parse_json.rb:30:in `parse'
from vendor/bundle/rub
@josacar
josacar / strace.log
Created July 20, 2015 01:51
chef_zero ( chef-client uses local-mode ) + vagrant-berkshelf + vagrant 1.7.3
stat("/tmp/vagrant-chef/85173cdf1c8190cb66c677319eb25007/cookbooks/ntp/files/default/.", {st_mode=S_IFDIR|0755, st_size=204, ...}) = 0
stat("/tmp/vagrant-chef/85173cdf1c8190cb66c677319eb25007/cookbooks/ntp/files/default/..", {st_mode=S_IFDIR|0755, st_size=136, ...}) = 0
stat("/tmp/vagrant-chef/85173cdf1c8190cb66c677319eb25007/cookbooks/ntp/files/default/ntp.ini", {st_mode=S_IFREG|0644, st_size=388, ...}) = 0
stat("/tmp/vagrant-chef/85173cdf1c8190cb66c677319eb25007/cookbooks/ntp/files/default/ntp.leapseconds", {st_mode=S_IFREG|0644, st_size=10384, ...}) = 0
stat("/tmp/vagrant-chef/85173cdf1c8190cb66c677319eb25007/cookbooks/ntp/files/default/tests", {st_mode=S_IFDIR|0755, st_size=102, ...}) = 0
stat("/tmp/vagrant-chef/85173cdf1c8190cb66c677319eb25007/cookbooks/ntp/files/default/usr.sbin.ntpd.apparmor", {st_mode=S_IFREG|0644, st_size=2206, ...}) = 0
stat("/tmp/vagrant-chef/85173cdf1c8190cb66c677319eb25007/cookbooks/ntp/files/default/ntp.ini", {st_mode=S_IFREG|0644, st_size=388, ...}) = 0
stat("/tmp/vagrant-chef/
@josacar
josacar / chef-12-error.log
Created December 5, 2014 20:52
Chef Client 12 error
reirb(main):001:0> require 'chef/client'
DL is deprecated, please use Fiddle
NoMethodError: undefined method `identity_attr' for Chef::Resource::File:Class
from /home/vagrant/code/platform/infra/vendor/bundle/ruby/2.1.0/gems/chef-12.0.0/lib/chef/resource/file.rb:29:in `<class:File>'
from /home/vagrant/code/platform/infra/vendor/bundle/ruby/2.1.0/gems/chef-12.0.0/lib/chef/resource/file.rb:26:in `<class:Resource>'
from /home/vagrant/code/platform/infra/vendor/bundle/ruby/2.1.0/gems/chef-12.0.0/lib/chef/resource/file.rb:25:in `<class:Chef>'
from /home/vagrant/code/platform/infra/vendor/bundle/ruby/2.1.0/gems/chef-12.0.0/lib/chef/resource/file.rb:24:in `<top (required)>'
from /home/vagrant/code/platform/infra/vendor/bundle/ruby/2.1.0/gems/chef-12.0.0/lib/chef/provider/file.rb:22:in `require'
from /home/vagrant/code/platform/infra/vendor/bundle/ruby/2.1.0/gems/chef-12.0.0/lib/chef/provider/file.rb:22:in `<top (required)>'
from /home/vagrant/code/platform/infra/vendor/bundle/ruby/2.1.0/gems/chef-12.0.0/lib/c
#!/sbin/sh
# Heavily based on M1cha's script http://d-h.st/FWz
# Adapted to increase size of system, system1, cache and data partition and decreasing storage partition ( sdcard )
# get file descriptor for output
OUTFD=$(ps | grep -v "grep" | grep -o -E "update_binary(.*)" | cut -d " " -f 3);
# same as progress command in updater-script, for example:
#
# progress 0.25 10
# Infra
cookbook=_APP_
while inotifywait -e modify -e delete -e create -e move -r cookbooks -qq; do bundle exec strainer test $cookbook -s Strainerfile.chefspec; done
# App
while inotifywait -e modify -e delete -e create -e move -r lib spec -qq; do bundle exec rspec; done