Wide open nginx CORS configuration CORS is a W3C working standard that currently has decent (but inconsistent) implementions in Firefox, Chrome and Safari. I use it primarily to test PhoneGap apps in regular browsers instead of testing the code in simulators. PhoneGap apps can skip the usual origin checks via configuration, but running a PhoneGap app takes more setup - which make it harder for designers to work with the app. Running apps in simulators or on actual devices also takes al lot more time that just reloading a browser and this annoys me.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<v-dialog v-model="dialog" :max-width="options.width" :style="{ zIndex: options.zIndex }" @keydown.esc="cancel"> | |
<v-card> | |
<v-toolbar dark :color="options.color" dense flat> | |
<v-toolbar-title class="white--text">{{ title }}</v-toolbar-title> | |
</v-toolbar> | |
<v-card-text v-show="!!message" class="pa-4">{{ message }}</v-card-text> | |
<v-card-actions class="pt-0"> | |
<v-spacer></v-spacer> | |
<v-btn color="primary darken-1" text @click.native="agree">Yes</v-btn> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# get total requests by status code | |
awk '{print $9}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | |
# get top requesters by IP | |
awk '{print $1}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head | awk -v OFS='\t' '{"host " $2 | getline ip; print $0, ip}' | |
# get top requesters by user agent | |
awk -F'"' '{print $6}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head | |
# get top requests by URL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Example for MySQL 5.7 how to use JOIN on 2 tables without junction table using new JSON column type. | |
# Let say we have 2 tables: posts and users | |
# Users may like posts | |
# We store the IDs of users who liked each post in posts.liked column which is a JSON array | |
# which might have a content like "[1, 2, 5, 10]" | |
SELECT posts.id AS post_id, users.id AS liked_by_user_id FROM posts JOIN users ON JSON_CONTAINS(posts.liked, CAST(users.id AS CHAR)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Basic example | |
siege -t60s -c20 -d10 'http://robertomurray.co.uk/' | |
# Basic auth; | |
auth=$(echo -n 'username:password' | openssl base64) | |
siege -t60s -c20 -d10 --header="Authorization:Basic $auth" 'https://staging.a-hostname.co.uk/' |
Moved to git repository: https://github.com/denji/jetbrains-cleanup-backup
Quick uninstall
JetBrains settings:
curl -sL https://gist.github.com/denji/9731967/raw/jetbrains-uninstall.sh | bash -s
Quick backup
JetBrains settings:
curl -sL https://gist.github.com/denji/9731967/raw/jetbrains-backup.sh | bash -s