Skip to content

Instantly share code, notes, and snippets.

@jaturken
jaturken / routes_list.sh
Created August 15, 2016 11:38
API routes
new_v1_user_session GET /v1/auth/sign_in(.:format) devise_token_auth/sessions#new
v1_user_session POST /v1/auth/sign_in(.:format) devise_token_auth/sessions#create
destroy_v1_user_session DELETE /v1/auth/sign_out(.:format) devise_token_auth/sessions#destroy
v1_user_password POST /v1/auth/password(.:format) devise_token_auth/passwords#create
new_v1_user_password GET /v1/auth/password/new(.:format) devise_token_auth/passwords#new
edit_v1_user_password GET /v1/auth/password/edit(.:format) devise_token_auth/passwords#edit
PATCH /v1/auth/password(.:format) devise_token_auth/passwords#update
PUT /v1/auth/password(.:format) devise_token_auth/passwords#update
cancel_v1_user_registration GET /v1/auth/cancel(.:format)
@jaturken
jaturken / hack.js
Last active February 3, 2019 20:27
var source_url = "http://maismedicos.saude.gov.br/new/web/app.php/selecao-municipio/selecionar"
const returnedBack = async (url) => { return await fetch(url).then(response => (document.URL == response.url)) }
i = 0;
keep_on_trying = true;
while (keep_on_trying) {
if (await returnedBack(source_url)) {
i += 1;
console.log(`[${i}]Still not available, retry`);
} else {
@jaturken
jaturken / cron message
Created April 20, 2021 09:32
Crontab expression: put random Chuck joke to shell login message. Run in root.
5 * * * * /usr/bin/curl --silent http://api.icndb.com/jokes/random | jq '.value.joke' | tail -c +2 | head -c -2 > /etc/motd 2>&1