Skip to content

Instantly share code, notes, and snippets.

View diasjorge's full-sized avatar
🤖

Jorge Dias diasjorge

🤖
View GitHub Profile
@diasjorge
diasjorge / empty-topic.sh
Created December 10, 2018 17:15
Empty kafka topic
topic="TOPICNAME"
/opt/kafka/bin/kafka-topics.sh --zookeeper $ZOOKEEPERSRV --describe --topic $topic
kconfigs --alter --entity-type topics --entity-name $topic --add-config cleanup.policy=delete
num_partitions=$(/opt/kafka/bin/kafka-topics.sh --zookeeper $ZOOKEEPERSRV --describe --topic $topic | grep PartitionCount | awk '{print $2}' | cut -d: -f 2)
echo '{"partitions": [' > /tmp/offset-file.json
@diasjorge
diasjorge / Dockerfile
Created December 4, 2018 16:14
Dockerfile for serverless python builds
FROM amazonlinux:1
RUN mkdir /var/task
RUN yum install -y python27-pip
RUN pip install -U pip
WORKDIR /var/task
for i in `ls`; do echo $i; cd $i; git co master; git pull; git branch -vv | grep -v origin | awk '{print $2}' | xargs git branch -D; cd ..; done
;;; load-env-file.el --- Load environment variables from files -*- lexical-binding: t; -*-
;; Copyright (C) 2018 Jorge Dias
;; Author: Jorge Dias <jorge@mrdias.com>
;; Keywords: lisp
;; Version: 0.0.1
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
import kafka.conn
from kafka import protocol
import collections
ip, port, afi = kafka.conn.get_ip_port_afi('localhost:9092')
bc = kafka.conn.BrokerConnection(ip, port, afi)
bc.check_version()
bc.send(protocol.admin.ListGroupsRequest[0]())
bc.recv()
#! /usr/bin/env ruby
require 'yaml'
config = YAML.load(DATA.read)
config.each do |name, env_config|
puts "setup #{name}"
puts %{roly exec -- #{env_config['profile']} env DYNAMODB_BACKUPS_TABLES=#{env_config['tables'].join(',')} serverless deploy --stage #{env_config['stage']}}
end
;; This buffer is for text that is not saved, and for Lisp evaluation.
;; To create a file, visit it with C-o and enter text in its buffer.
(defun magithub--url->domain (url)
"Tries to parse a remote url into a domain"
(cdr (assq 'domain (magithub--parse-url url))))
(add-hook 'magit-status-mode-hook '(lambda ()
(if (magithub-github-repository-p)
@diasjorge
diasjorge / albums.rb
Last active July 15, 2017 21:11
Album fixes
require 'fileutils'
require 'date'
# Sort by date taken
pics = Dir.glob('*.jpg', File::FNM_CASEFOLD)
sorted_pics = pics.sort_by do |f|
%x{identify -format "%[EXIF:DateTime]" "#{f}"}
end
# Rename by sorted order
sorted_pics.each_with_index do |f, i|
curl -v -X GET /api/v1/users/:id \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: SSWS ${api_token}" \
"https://${org}.oktapreview.com/api/v1/users/${login}"

Keybase proof

I hereby claim:

  • I am diasjorge on github.
  • I am dias_jorge (https://keybase.io/dias_jorge) on keybase.
  • I have a public key ASDymOi_S-7rR4YF2J6d0rkn9ajFQexaCsz360LWfnUBmgo

To claim this, I am signing this object: