Skip to content

Instantly share code, notes, and snippets.

View keybase.md

Keybase proof

I hereby claim:

  • I am zx1986 on github.
  • I am zx1986 (https://keybase.io/zx1986) on keybase.
  • I have a public key ASAP9ECvEaZPOUWD_7PRTFJtmAFZ9hi839HspwgfOWV91go

To claim this, I am signing this object:

@zx1986
zx1986 / regexCheatsheet.js
Created Jan 15, 2019 — forked from sarthology/regexCheatsheet.js
A regex cheatsheet 👩🏻‍💻 (by Catherine)
View regexCheatsheet.js
let regex;
/* matching a specific string */
regex = /hello/; // looks for the string between the forward slashes (case-sensitive)... matches "hello", "hello123", "123hello123", "123hello"; doesn't match for "hell0", "Hello"
regex = /hello/i; // looks for the string between the forward slashes (case-insensitive)... matches "hello", "HelLo", "123HelLO"
regex = /hello/g; // looks for multiple occurrences of string between the forward slashes...
/* wildcards */
regex = /h.llo/; // the "." matches any one character other than a new line character... matches "hello", "hallo" but not "h\nllo"
regex = /h.*llo/; // the "*" matches any character(s) zero or more times... matches "hello", "heeeeeello", "hllo", "hwarwareallo"
@zx1986
zx1986 / ansible-role-test.sh
Last active Sep 12, 2018 — forked from geerlingguy/ansible-role-test.sh
Ansible Role Test Shim Script
View ansible-role-test.sh
#!/bin/bash
#
# Ansible role test shim.
#
# Usage: [OPTIONS] ./tests/test.sh
# - distro: a supported Docker distro version (default = "centos7")
# - playbook: a playbook in the tests directory (default = "test.yml")
# - role_dir: the directory where the role exists (default = $PWD)
# - cleanup: whether to remove the Docker container (default = true)
# - container_id: the --name to set for the container (default = timestamp)
View ror.rb
class ScenariosController < ApplicationController
include ScenarioCopier
before_action :set_scenario, only: [:show, :copy, :edit, :tree, :update, :destroy]
respond_to :java
# GET /scenarios
def index
authorize! :index, Scenario
render json: Scenario.where(:locked => false, :university => current_user.university)
end
# GET /scenarios/1
@zx1986
zx1986 / docker-compose.yml
Last active Nov 16, 2016
Redmine with Postgresql in Docker
View docker-compose.yml
version: '2'
services:
redmine:
image: sameersbn/redmine:3.3.1
environment:
- TZ=Asia/Taipei
- DB_ADAPTER=mysql2
@zx1986
zx1986 / Gemfile
Last active Oct 1, 2016
Get YouTube URLs from iThome
View Gemfile
source 'https://rubygems.org'
gem 'nokogiri'
@zx1986
zx1986 / ansible_conditionals_examples.yaml
Created Aug 2, 2016 — forked from marcusphi/ansible_conditionals_examples.yaml
Ansible 1.3 Conditional Execution -- Very complete example with comments -- I find the conditional expressions to be ridiculously hard to get right in Ansible. I don't have a good model of what's going on under the surface so I often get it wrong. What makes it even harder is that there has been at least three different variants over the course …
View ansible_conditionals_examples.yaml
---
# This has been tested with ansible 1.3 with these commands:
# ansible-playbook -i hosts ansible_conditionals_examples.yaml --extra-vars="hosts=myhosts isFirstRun=false"
# ansible-playbook -i hosts ansible_conditionals_examples.yaml --extra-vars="hosts=myhosts isFirstRun=true"
# ansible-playbook -i hosts ansible_conditionals_examples.yaml --extra-vars="hosts=myhosts"
# NB: The type of the variable is crucial!
- name: Ansible Conditionals Examples
hosts: $hosts
vars_files:
View tmux_cheatsheet.markdown

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

You can’t perform that action at this time.