Skip to content

Instantly share code, notes, and snippets.

View marianposaceanu's full-sized avatar

Posăceanu Marian marianposaceanu

View GitHub Profile

How to use top_history.sh

Overview

top_history.sh is a script that displays the top 10 most used commands from the zsh history. It generates a bar chart using Gnuplot to visualize the command frequencies.

Requirements

Before using top_history.sh, make sure you have the following requirements installed on your system:

  1. Zsh Shell: This script is designed for use with the Zsh shell. Ensure you have Zsh installed as your default shell.

Comparison of setting a key to Redis

note: Redis is running locally with a maximum of 10K connections

 set LZ4 + MessagePack:    401.7 i/s
           set Marshal:    232.3 i/s - 1.73x  slower
     set LZ4 + Marshal:    176.4 i/s - 2.28x  slower
              set to_s:    141.5 i/s - 2.84x  slower
 set Snappy + Marshal: 92.6 i/s - 4.34x slower
# A simple way to measure start-up time from inside Java application
# credits:
# - https://stackoverflow.com/questions/39321345/how-do-i-measure-jvm-startup-time
#
# How to run:
#
# 0. install JRuby (brew, rvm, etc.) e.g. `rvm install jruby-9.2.11.1`
# 1. download this script
# 2. in the shell run `for i in {1..10}; do ruby jruby_start_up.rb; done | awk '{ total += $1; count++ } END { print total/count }'`
# => 1673.9
@marianposaceanu
marianposaceanu / disable.sh
Created December 31, 2019 00:04
Disable bunch of #$!@ in Catalina
#!/bin/bash
# IMPORTANT: Don't forget to logout from your Apple ID in the settings before running it!
# IMPORTANT: You will need to run this script from Recovery. In fact, macOS Catalina brings read-only filesystem which prevent this script from working from the main OS.
# This script needs to be run from the volume you wish to use.
# E.g. run it like this: cd /Volumes/Macintosh\ HD && sh /Volumes/Macintosh\ HD/Users/sabri/Desktop/disable.sh
# WARNING: It might disable things that you may not like. Please double check the services in the TODISABLE vars.
# Get active services: launchctl list | grep -v "\-\t0"
# Find a service: grep -lR [service] /System/Library/Launch* /Library/Launch* ~/Library/LaunchAgents

Keybase proof

I hereby claim:

  • I am marianposaceanu on github.
  • I am dakull (https://keybase.io/dakull) on keybase.
  • I have a public key ASAh1wAzfMC9-2TW-ZwfKJU7fwtpkS-Yh17tNzAjpAWtHgo

To claim this, I am signing this object:

require 'benchmark'
timings = {}
measure_feature = -> feature_path {
time = Benchmark.measure {
puts "Benchmarking feature #{feature_path}."
cmd = `cucumber --format json -r features '#{feature_path}'`
}
@marianposaceanu
marianposaceanu / capybara cheat sheet
Created August 29, 2016 12:55 — forked from zhengjia/capybara cheat sheet
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@marianposaceanu
marianposaceanu / octopus.rest.md
Last active June 10, 2016 12:05
octopus.rest - state of the art REST client

@marianposaceanu
marianposaceanu / mkvit.rb
Last active May 19, 2016 10:45
Convert videos to H.264 mkv easily (using ffmpeg)
# _ _ _
# | | (_)| |
# _ __ ___ | | ____ __ ______ _ | |_
# | '_ ` _ \ | |/ /\ \ / /|______|| || __|
# | | | | | || < \ V / | || |_
# |_| |_| |_||_|\_\ \_/ |_| \__|
#
# Simple script to convert your old video files to H.264 mantaining their quality
#
# Usage: