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
module CurrentUser | |
def signed_in? | |
!current_user.nil? | |
end | |
def sign_in(user) | |
self.current_user, session["user_id"] = user, user.id | |
end | |
def sign_out |
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
'autologin.vbs | |
'自动打开某网站并填写表单 | |
Dim ie | |
Set ie=CreateObject("InternetExplorer.Application") '创建IE应用程序对象 | |
ie.Visible=True '设置IE窗体可见 | |
ie.Navigate "http://www.xxt.cn" '导航到相应网站 | |
While ie.busy Or ie.readystate <> 4 '等待网页加载完毕 | |
Wend | |
'填写表单并点击登录 | |
ie.document.frames(0).document.loginForm.userName.value="username" |
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
Windows Registry Editor Version 5.00 | |
[HKEY_CLASSES_ROOT\*\shell] | |
[HKEY_CLASSES_ROOT\*\shell\openwemacs] | |
@="&Edit with Emacs" | |
[HKEY_CLASSES_ROOT\*\shell\openwemacs\command] | |
@="E:\\tools\\emacs\\bin\\runemacs.exe \"%1\"" | |
[HKEY_CLASSES_ROOT\Directory\shell\openwemacs] | |
@="Edit &with Emacs" | |
[HKEY_CLASSES_ROOT\Directory\shell\openwemacs\command] |
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
#!/usr/bin/env bash | |
JMETER_PATH=/path/to/jmeter | |
JMETER_PLAN_DIR=/path/to/jmx | |
set -xe | |
cd $(dirname $0) | |
pwd | |
for file in $(ls $JMETER_PLAN_DIR); do |
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
telnet mail.host 25 | |
ehlo mail.host #握手 | |
mail from:<test@mail.host> #发送方 | |
rcpt to: <testing@target.mail.host> #收件方 | |
data #正文 | |
TO: testing@target.mail.host | |
FROM: test@mail.host | |
SUBJECT: telnet test | |
test,aha |
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
#!/bin/bash | |
sudo apt-get install -y xfonts-utils fontconfig | |
cd `dirname $0` | |
mkdir msyh | |
cd msyh | |
curl -O https://coding.net/u/vamdt/p/fonts/git/raw/master/msyh.ttf | |
curl -O https://coding.net/u/vamdt/p/fonts/git/raw/master/msyhbd.ttf | |
cd .. | |
sudo cp -r ./msyh /usr/share/fonts/truetype/ |
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
defmodule Fib do | |
def fib(n) when n < 2 do | |
n | |
end | |
def fib(n) when n >= 2 do | |
fib(n-1) + fib(n-2) | |
end |
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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
Vagrant.configure(2) do |config| | |
config.vm.box = "u14" | |
# config.vm.box_url = "http://mirrors.opencas.cn/ubuntu-vagrant/vagrant/trusty/20160323.1/trusty-server-cloudimg-amd64-vagrant-disk1.box" | |
config.vm.hostname = "vamdt" |
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
package com.vamdt.api.common | |
import com.mchange.v2.c3p0.AbstractConnectionCustomizer; | |
import java.sql.Connection; | |
import java.sql.Statement; | |
public class UTF8MB4ConnectionCustomizer extends AbstractConnectionCustomizer { | |
@Override | |
public void onAcquire(Connection c, String parentDataSourceIdentityToken) throws Exception { |
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
e.=explorer . | |
gl=git log --oneline --all --graph --decorate $* | |
ls=ls --color --show-control-chars $* | |
pwd=cd | |
clear=cls | |
history=cat %CMDER_ROOT%\config\.history | |
unalias=alias /d $1 | |
g=git $* | |
gs=git status $* |