Skip to content

Instantly share code, notes, and snippets.

@groyoh
groyoh / git-stat
Last active May 26, 2022 19:51
`git stat` command
#!/bin/sh
#
# To be placed in a directory that's present in $PATH.
usage() {
cat <<EOF
Usage: git stat [OPTIONS] [--] [<commit>]
Options:
@groyoh
groyoh / install.fish
Last active December 22, 2017 11:44
IRB on Mac
brew install readline
env RUBY_CONFIGURE_OPTS=--with-readline-dir=(brew --prefix readline) asdf install ruby 2.3.1
echo '# /etc/inputrc - global inputrc for libreadline
# See readline(3readline) and `info rluserman' for more information.
# Be 8 bit clean.
set input-meta on
set output-meta on
# To allow the use of 8bit-characters like the german umlauts, uncomment
@groyoh
groyoh / decrypt_session.rb
Last active May 11, 2017 16:45
Decrypt session
# Rails 4.2.7
salt = "encrypted cookie"
signed_salt = "signed encrypted cookie"
key_generator = Rails.application.key_generator
secret = key_generator.generate_key(salt)
sign_secret = key_generator.generate_key(signed_salt)
digest = Rails.application.config.action_dispatch.cookies_digest || "SHA1"
@groyoh
groyoh / ams_2025.rb
Created January 13, 2017 18:17
AMS #2025
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
gem 'rails', '4.2.6'
@groyoh
groyoh / ams_2014.rb
Created January 7, 2017 13:40
AMS #2014
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
gem 'rails', '4.2.6'
@groyoh
groyoh / Makefile
Last active September 1, 2021 22:45
CMocka example
.PHONY: test install
CMOCKA_DIR=$(shell pwd)/cmocka-1.1.0
CMOCKA_BUILD_DIR=$(CMOCKA_DIR)/build
CMOCKA_OUT_DIR=$(CMOCKA_BUILD_DIR)/output
all: test
test:
gcc test.c my_function.c -L./lib -I./ -I./include -lcmocka -o cmockatest
@groyoh
groyoh / ams_1971.rb
Last active November 20, 2016 15:32
AMS #1971
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
gem 'rails', '4.2.6'
@groyoh
groyoh / ams_1944.rb
Created October 24, 2016 10:56
AMS #1944
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
gem 'active_model_serializers', '0.10.2'
@groyoh
groyoh / ams_1950.rb
Last active December 21, 2017 05:12
AMS #1950
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
gem 'active_model_serializers', '0.10.2'
@groyoh
groyoh / ams_1946.rb
Created October 24, 2016 09:08
AMS #1946
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'