Skip to content

Instantly share code, notes, and snippets.

the bash_profile snippet will let you run the first file when you press tab when you have empty command , you need to put the cmd file in your path and make it executable with chmod +x cmd

class ThreadPool
def self.execute(objects:, method:, pool: 5)
new(objects: objects, method: method, pool: pool).execute
end
def initialize(objects:, method:, pool:)
@objects = objects
@method = method
@pool = pool
@queue = queue
#!/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>