This file contains hidden or 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/sh | |
# | |
# ip_conntrack: Plugin to monitor the number of tracked connection | |
if [ "$1" = "config" ]; then | |
echo "graph_title Number of tracked connections" | |
echo "graph_args --base 1000" | |
echo "graph_vlabel connections" | |
echo "graph_category network" | |
echo "connection.label connections" |
This file contains hidden or 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 | |
if [ x"" == x"$1" ]; then | |
echo "Usage: $0 PROJECT_NAME" | |
exit | |
fi | |
rails $1 | |
cd $1 | |
for d in $(find -type d -empty); do touch $d/.git_placeholder; done |
This file contains hidden or 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
(function(){ | |
cnt=prompt("へぇの数"); | |
CookieHeCnt=(int)(cnt)-1; | |
HeClick(); | |
})(); |
This file contains hidden or 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
// ==UserScript== | |
// @name 3gokushi-Beyond | |
// @namespace 3gokushi-hatt | |
// @description ブラウザ三国志用便利機能色々ごった煮 by hatt+ろむ+α | |
// @include http://*.3gokushi.jp/* | |
// @author hatt,romer,etc... | |
// @version 1.27.2.6 | |
// ==/UserScript== | |
// | |
// FireFox / Google Chrome対応です。 |
This file contains hidden or 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
// ==UserScript== | |
// @name bro3_trade_util | |
// @namespace 3gokushi | |
// @description ブラ三トレード支援ツール | |
// @include http://m*.3gokushi.jp/card/deck.php* | |
// ==/UserScript== | |
var d = document; | |
var $ = function(id) { return d.getElementById(id); }; | |
var $x = function(xp,dc) { return d.evaluate(xp, dc||d, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; }; |
This file contains hidden or 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
// ==UserScript== | |
// @name bro3_auto_phantom | |
// @version 0.1 | |
// @description enter something useful | |
// @match http://m17.3gokushi.jp/card/event_battle_top.php?scope=4* | |
// @match http://m17.3gokushi.jp/card/event_battle_result.php* | |
// @match http://m17.3gokushi.jp/card/event_battle_attack.php* | |
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js | |
// @copyright 2012+, You | |
// ==/UserScript== |
This file contains hidden or 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
try { | |
// $pdo は接続オブジェクト | |
$pdo = new PDO("mysql:host=localhost; dbname=pdotest", | |
"root", "pass"); | |
$stmt = $pdo->query("SELECT * FROM CD"); | |
while($row = $stmt->fetch(PDO::FETCH_ASSOC)){ | |
echo implode(", ", $row) . PHP_EOL; | |
} | |
} catch (PDOException $e){ |
This file contains hidden or 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 PaperTrail | |
module Model | |
module InstanceMethods | |
private | |
def item_before_change | |
attributes.tap do |prev| | |
enums = self.respond_to?(:defined_enums) ? self.defined_enums : {} | |
changed_attributes.select { |k,v| self.class.column_names.include?(k) }.each do |attr, before| | |
before = enums[attr][before] if enums[attr] | |
if defined?(CarrierWave::Uploader::Base) && before.is_a?(CarrierWave::Uploader::Base) |
This file contains hidden or 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 Devise | |
module Encryptable | |
module Encryptors | |
class MessageEncryptor < Base | |
class << self | |
def digest(password, stretches, salt, papper) | |
encryptor = ::ActiveSupport::MessageEncryptor.new(papper) | |
encryptor.encrypt_and_sign(password) | |
end | |
alias :encrypt :digest |
This file contains hidden or 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
class AasmvizController < ApplicationController | |
before_action :authenticate_account! | |
before_action :require_admin! | |
def index | |
Rails.application.eager_load! | |
@models = ActiveRecord::Base.descendants.select { |c| c.respond_to? :aasm } | |
end | |
def show |
OlderNewer