git branch {tagname}-branch {tagname}
git checkout {tagname}-branch git add .
git ci -m "Fix included" # or cherry-pick the commit, whatever is easier
git cherry-pick {num_commit}| # | |
| # Slightly tighter CORS config for nginx | |
| # | |
| # A modification of https://gist.github.com/1064640/ to include a white-list of URLs | |
| # | |
| # Despite the W3C guidance suggesting that a list of origins can be passed as part of | |
| # Access-Control-Allow-Origin headers, several browsers (well, at least Firefox) | |
| # don't seem to play nicely with this. | |
| # |
| #!/bin/bash | |
| rm /tmp/image-pull-secret.yaml | |
| login_cmd=$(aws ecr get-login) | |
| username=$(echo $login_cmd | cut -d " " -f 4) | |
| password=$(echo $login_cmd | cut -d " " -f 6) | |
| endpoint=$(echo $login_cmd | cut -d " " -f 9) | |
| auth=$(echo "$username:$password" | /usr/bin/base64) | |
| configjson="{ \"auths\": { \"${endpoint}\": { \"auth\": \"${auth}\" } } }" |
| rabbitmqctl list_connections pid port state user vhost recv_cnt send_cnt send_pend name | awk '{print "rabbitmqctl close_connection \"" $1 "\" \"manually closing idle connection\"" | "/bin/bash" }' |
| ## Useful Commands | |
| Get kubectl version | |
| kubectl version | |
| Get cluster info: |
Sidekiq jobs can be enqueued or scheduled. Enqueued means that they are gonna be picked up as soon as possible, scheduled jobs will be enqueued at some specific time.
When using ActiveJobs, Rails will return a job_id after sending the job to ActiveJobs
job = UserMailer.send_invite(params).deliver_later
At some point you’ll find yourself in a situation where you need edit a commit message. That commit might already be pushed or not, be the most recent or burried below 10 other commits, but fear not, git has your back 🙂.
git commit --amendThis will open your $EDITOR and let you change the message. Continue with your usual git push origin master.
| set :rbenv, '"$HOME/.rbenv/shims":"$HOME/.rbenv/bin"' | |
| job_type :rake, 'cd :path && PATH=:rbenv:"$PATH" :environment_variable=:environment bundle exec rake :task --silent :output' | |
| job_type :runner, 'cd :path && PATH=:rbenv:"$PATH" bin/rails runner -e :environment ":task" :output' | |
| set :output, 'log/whenever.log' |
Sometimes you may want to undo a whole commit with all changes. Instead of going through all the changes manually, you can simply tell git to revert a commit, which does not even have to be the last one. Reverting a commit means to create a new commit that undoes all changes that were made in the bad commit. Just like above, the bad commit remains there, but it no longer affects the the current master and any future commits on top of it.
git revert {commit_id}'
Deleting the last commit is the easiest case. Let's say we have a remote origin with branch master that currently points to commit dd61ab32. We want to remove the top commit. Translated to git terminology, we want to force the master branch of the origin remote repository to the parent of dd61ab32:
| FILE SPACING: | |
| # double space a file | |
| sed G | |
| # double space a file which already has blank lines in it. Output file | |
| # should contain no more than one blank line between lines of text. | |
| sed '/^$/d;G' |