Skip to content

Instantly share code, notes, and snippets.

from django.http import HttpResponseRedirect
from django.conf import settings
# from django.views.decorators.clickjacking import xframe_options_exempt
from re import compile
EXEMPT_URLS = [compile(settings.LOGIN_URL.lstrip('/'))]
if hasattr(settings, 'LOGIN_EXEMPT_URLS'):
EXEMPT_URLS += [compile(expr) for expr in settings.LOGIN_EXEMPT_URLS]
class LoginRequiredMiddleware:
@nobiki
nobiki / bootlocal.sh
Last active March 28, 2017 17:18
docker-machine - /var/lib/boot2docker/bootlocal.sh
ln -s /var/lib/boot2docker/tools/docker-compose-Linux-x86_64 /usr/local/bin/docker-compose
ln -s /var/lib/boot2docker/containers/ /var/containers
map h goBack
map l goForward
map H previousTab
map L nextTab
map i LinkHints.activateMode
map I LinkHints.activateModeToOpenInNewTab
#!/bin/sh
status="$1"
ext="$2"
if [ '!' = "${1}" ]; then
status='\!'
elif [ '' = "${1}" ]; then
status=''
fi
<?php
use Behat\Behat\Context\Context;
use Behat\MinkExtension\Context\RawMinkContext;
use Behat\Mink\WebAssert;
use Behat\Behat\Context\SnippetAcceptingContext;
use Behat\Gherkin\Node\PyStringNode;
use Behat\Gherkin\Node\TableNode;
use WebDriver\Session;
@nobiki
nobiki / scp.sync
Last active November 22, 2017 00:41
#!/bin/bash
if [ "upload" == $1 ];then
scp `dirname $0`/$2/$3 hostname:/path/to/workspace/$2/$3
elif [ 'download' == $1 ];then
scp hostname:/path/to/workspace/$2/$3 `dirname $0`/$2/$3
fi
# Compose:
# docker-compose -f trello.yml run --rm trello [board|list|card]
# API Key:
# https://trello.com/1/appKey/generate
# Member Token:
# [RO] https://trello.com/1/connect?key=YOUR_API_KEY&name=trello-cli&response_type=token
# [RW] https://trello.com/1/authorize?key=YOUR_API_KEY&name=trello-cli&expiration=never&response_type=token&scope=read,write
version: "2"
# -*- mode: ruby -*-
# vi: set ft=ruby :
# A dummy plugin for Barge to set hostname and network correctly at the very first `vagrant up`
module VagrantPlugins
module GuestLinux
class Plugin < Vagrant.plugin("2")
guest_capability("linux", "change_host_name") { Cap::ChangeHostName }
guest_capability("linux", "configure_networks") { Cap::ConfigureNetworks }
end
end
#
# 説明:
# カレントディレクトリにある空のディレクトリを検出して、
# ディレクトリが空であればREPO_URLからgit cloneするワンライナー
ACCOUNT_NAME=nobiki
# REPO_URL="https://${ACCOUNT_NAME}@example.com/nobiki/"
REPO_URL="git@example.com:${ACCOUNT_NAME}/"
find ./ -type d -maxdepth 1 -empty | sed -e "s/\.\///g" | while read line; do echo -e "\e[1;32m-> $line \n \e[m" && git clone --recursive "$REPO_URL$line.git"; done
@nobiki
nobiki / robot-dict.vim
Last active July 23, 2018 07:39
robotframework dictionary for vim (built-in, seleniumlibrary)
set dictionary=~/.vim/dict/robot-built-in.dict
set dictionary=~/.vim/dict/robot-selenium-library.dict
fun! CompleteSpace()
" Save cursor position
let l:save_cursor = getpos(".")
" Get word we just completed ('borrowed' from: http://stackoverflow.com/a/23541748/660921)
let l:word = matchstr(strpart(getline('.'), 0, col('.') - 1), '\k\+$')