Skip to content

Instantly share code, notes, and snippets.

View prathe's full-sized avatar

Philippe Rathé prathe

  • Remote, North America
View GitHub Profile

Show all unused index since the last MySQL server restart (MySQL 5.6+)

SELECT object_schema, object_name, index_name
FROM performance_schema.table_io_waits_summary_by_index_usage 
WHERE index_name IS NOT NULL AND count_star = 0
ORDER BY object_schema, object_name;
cat tmp/appstrategy | xargs perl -p -i -e "s/(RSpec.describe .+) do$/\1, auth_strategy: \'app_user_cookies\' do/"
@prathe
prathe / gitdo.zsh
Last active August 31, 2023 20:27
Git Rspec/Rubocop commands
bundle exec rubocop -c .rubocop_exclusion.yml --fail_level convention --display-only-fail-level-offenses
# Rubocop only files I modified/added, but not the one I deleted
git diff develop... --diff-filter=d --name-only | egrep "\\.rb$" |xargs bundle exec rubocop
git diff develop... --diff-filter=d --name-only | egrep "\\.rb$" |egrep -v db/schema.rb | xargs bundle exec rubocop
git diff develop... --diff-filter=d --name-only | egrep "\\.rb$" |egrep -v db/schema.rb | xargs bundle exec rubocop --fail_level convention --display-only-fail-level-offenses
git diff develop... --diff-filter=d --name-only | egrep "\\.rb$" |egrep -v db/schema.rb | xargs bundle exec rubocop -c .rubocop_exclusion.yml --fail_level convention --display-only-fail-level-offenses
git diff develop... --diff-filter=d --name-only | egrep "\\.rb$" |egrep -v db/schema.rb | xargs bundle exec rubocop -A -c .rubocop_exclusion.yml --fail_level convention
git diff --name-
# -A the staged
## .bash_profile
```
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
# Tell ls to be colourful
export CLICOLOR=1
export LSCOLORS=gxBxhxDxfxhxhxhxhxcxcx
# Tell grep to highlight matches
export GREP_OPTIONS='--color=auto'
@prathe
prathe / screen.sh
Created November 1, 2018 22:04
Managing Linux screens
# create with a name
screen -d -m -S elasticsearch:import:migrate
# list with PIDs
screen -list
# reopen one with PID
screen -r 12345
# Destroy with PID
@prathe
prathe / node-packages.md
Last active November 26, 2020 14:55
Common React/Node packages used in my projects
$ yarn add react@16.7.0 --save # select alpha version
$ yarn add react-dom@16.7.0 --save # select alpha version
$ yarn add react-bootstrap --save
$ yarn add react-router-dom --save
$ yarn add react-router-bootstrap --save
$ yarn add react-redux --save
@prathe
prathe / gist:2654048
Created May 10, 2012 15:48
Building and installing Zorba on Mac OSX from sources

Install gcc (Apple release) unless you have it

Needed to compile ICU.

Grab and unpack the tarball

mkdir ~/src && cd ~/src
curl -O http://opensource.apple.com/tarballs/gcc/gcc-5666.3.tar.gz
tar -zxvf gcc-5666.3.tar.gz

cd gcc-5666.3

@prathe
prathe / gist:2439752
Created April 21, 2012 21:33
Python Regular Expression: double-quoted string literals that allows for escaped double quotes
# Tricky REs with ^ and \
# Assign to regexp a regular expression for double-quoted string literals that
# allows for escaped double quotes.
# Hint: Escape " and \
# Hint: (?: (?: ) )
import re

Linus Torvalds about license

So when I try to explain my choice of license, I use the term ‘Open Source’, and try to explain my choice of the GPLv2 not in terms of freedom, but in terms of how I want people to be able to improve on the source code - by discouraging hiding and controlling of the source code with a legal copyright license

GPLv2 is there to keep it from anarchy: it doesn't block competition and people working at opposite ends, but it does block people from trying to be anti-social and hurt each other.

Subjects that Steve Klabnik could cover in his new book:
Taken from Fielding's dissertation
> As a result, cookie-based applications on the Web will never be reliable.
> The same functionality should have been accomplished via anonymous authentication and true client-side state.