Skip to content

Instantly share code, notes, and snippets.

View hadrienblanc's full-sized avatar

Hadrien Blanc hadrienblanc

  • Paris, France
View GitHub Profile
#!/bin/bash
# mass change xml filename
for file in *.xml; do
mv "$file" "${file%.xml}_p.xml"
done
ls | xargs -I {} mv {} PREF_{}
git diff --stat master
git log --stat
screeen -ls # list the screens
screen -S session_name # create a session
# how to detach ? : Ctrl+a d
screeen -ls # list the screens and find the ID
screen -r 42 # 42 is the ID of the screen
some_profile.avatar.attach(io: File.open('/path/to/file'), filename: 'avatar.png')
# mac OS 10.14
sudo dscacheutil -flushcache;sudo killall -HUP mDNSResponder
Post.where(created_at: Time.zone.now.beginning_of_day..Time.zone.now.end_of_day)
dw = Delayed::Worker.new
dj = Delayed::Job.last # assuming that the last job is the failed one, otherwise use a proper query to
# locate it
dw.run dj
echo "[test 200]"
echo "Script that tests we receive a 200 http code response from an array of urls."
echo ""
urls=(
https://www.google.fr
https://www.google.com
)
for url in "${urls[@]}"
SELECT table_schema AS "Database",
ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) AS "Size (MB)"
FROM information_schema.TABLES
GROUP BY table_schema;