Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env ruby
require 'tty-prompt'
require 'open-uri'
require 'json'
require 'colorize'
require 'colorized_string'
prompt = TTY::Prompt.new
user_name = prompt.ask("What is name of the user or organisation?")
@emad-elsaid
emad-elsaid / README.md
Created June 3, 2019 11:45
accepts a file or stream of file paths and it'll return every file with the last commit message and time under every path, and example down below

this script will read every line (file path) passed to it, then shows the last commit message and time (human readable period), you can use it to see who added png images and when to your project for example:

git ls-files | grep png | git-last-commit

you can get some results similar to the following:

images/screenshot.png
digitalcraftsman: Updated screenshots -- 3 years, 11 months ago
.
├── app
│   ├── assets
│   │   ├── config
│   │   │   └── manifest.js
│   │   ├── images
│   │   ├── javascripts
│   │   │   └── application.js
│   │   └── stylesheets
│   │   └── application.css

KAFKA DOCKER

Docker+zookeeper image https://hub.docker.com/r/spotify/kafka/

to run docker+zookeeper

docker run -p 2181:2181 -p 9092:9092 --env ADVERTISED_HOST=0.0.0.0 --env ADVERTISED_PORT=9092 spotify/kafka
#!/usr/bin/env ruby
require 'tty-prompt'
require 'open-uri'
require 'json'
require 'colorize'
require 'colorized_string'
prompt = TTY::Prompt.new
user_name = prompt.ask("What is name of the user or organisation?")
#!/usr/bin/env ruby
require 'io/console'
require 'bundler/inline'
gemfile do
gem 'net-ssh', require: 'net/ssh'
gem 'colorize', require: %w[colorize colorized_string]
end
DEFAULT_LINE_WIDTH = 100
input {
jdbc {
jdbc_driver_library => "drivers/postgresql-42.2.5.jar"
jdbc_driver_class => "org.postgresql.Driver"
jdbc_connection_string => "${DATABASE_URL}"
jdbc_user => "postgres"
schedule => "* * * * *"
statement => "SELECT * from rss_items where id > :sql_last_value order by id asc limit 100000"
use_column_value => true
tracking_column => "id"
#!/usr/bin/env erbview
<%
require 'redcarpet'
file = File.read(ARGV.shift)
markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, autolink: true, tables: true)
output = markdown.render(file)
%>
<!DOCTYPE html>
<html>
<head>
#!/usr/bin/env ruby
require 'erb'
require 'tmpdir'
require 'digest'
argv_hash = Digest::MD5.hexdigest(Dir.pwd + ARGV.join)
file = ARGV.shift
if file.nil? || file.empty? || file == '--help'
puts 'Usage: erbview FILE'
exit
@emad-elsaid
emad-elsaid / access_postgresql_with_docker.md
Created November 24, 2018 13:52 — forked from MauricioMoraes/access_postgresql_with_docker.md
Allow Docker Container Access to Host's Postgres Database on linux (ubuntu)

You have to do 2 things in order to allow your container to access your host's postgresql database

  1. Make your postgresql listen to an external ip address
  2. Let this client ip (your docker container) access your postgresql database with a given user

Obs: By "Host" here I mean "the server where docker is running on".

Make your postgresql listen to an external ip address

Find your postgresql.conf (in case you don't know where it is)

$ sudo find / -type f -name postgresql.conf