Skip to content

Instantly share code, notes, and snippets.

Avatar

xiaohui xiaohui-zhangxh

View GitHub Profile
@xiaohui-zhangxh
xiaohui-zhangxh / ucloud_api.rb
Created Mar 15, 2020
通过 UCloud API 管理资源
View ucloud_api.rb
# frozen_string_literal: true
require 'json'
require 'net/http'
require 'digest'
class UcloudAPI
API_HOST = 'https://api.ucloud.cn'
def initialize(public_key, private_key)
View capybara.md

Capybara

save_and_open_page

Matchers

have_button(locator)
@xiaohui-zhangxh
xiaohui-zhangxh / cloudSettings
Last active Jul 18, 2020
Visual Studio Code Settings Sync Gist
View cloudSettings
{"lastUpload":"2020-03-25T15:07:04.579Z","extensionVersion":"v3.4.3"}
@xiaohui-zhangxh
xiaohui-zhangxh / README.md
Created Nov 1, 2018 — forked from lgersman/README.md
improved state diagram editor based on https://gist.github.com/lgersman/5311202 featuring curvy connections with helper points
View README.md

new features

  • css improved
  • css transitions added

nodes

  • double click on a node to remove it
@xiaohui-zhangxh
xiaohui-zhangxh / dnspod_api.rb
Last active Mar 15, 2020
通过 QCloud/DnsPod API 动态更新域名解析
View dnspod_api.rb
# frozen_string_literal: true
require 'json'
require 'net/http'
class DnspodAPI
API_HOST = 'https://dnsapi.cn'
# API requires UserAgent contains app name/version and email
def initialize(token, app_name:, app_version:, email:)
@xiaohui-zhangxh
xiaohui-zhangxh / config.ru
Created Jun 4, 2018 — forked from cmer/config.ru
Gem In a Box basic authentication & authorization rackup file
View config.ru
#
# This is a simple rackup file for geminabox. It allows simple role-based authorization.
#
# roles:
# - developer
# - upload
# - delete
# - admin (can do anything)
#
# For example, a developer who can access the service and upload new gems would have the following roles: `%w(developer upload)
View tmux_cheatsheet.markdown

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

View ups_monitor.sh
#!/bin/bash
PING_COUNT=10
INFO_LOG=/var/log/ups_monitor.log
ERROR_LOG=/var/log/ups_monitor.err
STATUS_LOG=/tmp/ups_monitor.log
SHUTDOWN_LOG=/var/log/ups_monitor_shutdown.log
LOCKER=/tmp/ups_monitor.lock
SHUTDOWN_COUNTER=5
View multimodule_assets.rb
load 'deploy' unless defined?(_cset)
_cset :asset_env, "RAILS_GROUPS=assets"
_cset :assets_prefix, "assets"
_cset :assets_role, [:web]
_cset :normalize_asset_timestamps, false
before 'deploy:finalize_update', 'deploy:mm_assets:symlink'
after 'deploy:update_code', 'deploy:mm_assets:precompile'
@xiaohui-zhangxh
xiaohui-zhangxh / take_snapshot_of_mobile_website.rb
Created Oct 31, 2013
How to take snapshot for a mobile website
View take_snapshot_of_mobile_website.rb
=begin
** Install required packages
sudo apt-get install xvfb # fake X server
sudo apt-get install xfonts-base xfonts-75dpi xfonts-100dpi # fonts
sudo apt-get install iceweasel # this is firefox
=end
require 'headless'
require 'selenium-webdriver'
require 'webdriver-user-agent'
You can’t perform that action at this time.