View rdoc-field.vim
" use :RDF after copying lines from db/schema.rb to the class documentation
" the command transforms db/schema.rb lines to RDoc formatted list item
command -range=% RDF <line1>,<line2>s/\s\+t\.\(\w\+\)\s\+"\(.*\)"\($\|,.*\)/# +:\2+ _\1_::/
View maximum_users.ps1
# name of procsess we are tracking
$limited_process = "notepad.exe"
# limit of instances we allow
$user_limit = 3
# Limit reached message and title
$message = "Too many users! They are:"
$title = "No more notepad"
View bid_worker.rb
# A Mechanize based Sidekiq Worker that reports on new bid announcements in Norway
#
# This is used in a Rails app with a Bid model for storing known bids,
# and a BidMailer to send bid announcements to an email.
#
class BidWorker
include Sidekiq::Worker
sidekiq_options unique: true
def perform
View README.md
View README.md

Live backup of KVM virtual machines

This script will let you make backups of live VMs running on KVM, using libvirt.

The backup job will suspend the VM for the time it takes to copy the RAM to disk.

Credits: Luca Lazzeroni

I've made some minor adjustments.

View editablepage.html
<div id=page_1 data-url=/pages/1><>
<h1 class="rest-in-place" data-attribute="title">Nord-Norges stØrste næringsmagasin</h1>
<div id=pagebody_1 class="pagebody" data-attribute="body" data-formtype="trumbowyg" tabindex=1>
<h1>mama</h1>
<p>written text</p>
</div>
<script>
$("#pagebody_1").restInPlace();
</script>
View logoff_sessions.ps1
$timeout = 300
$message = "Please save your work. You will be logged off in "+ $timeout/60 +" minutes"
$sessions = @()
# Collect session IDs and warn users
query session | select-string "wdica" |
%{$_ -replace " {2,27}"," "} |
foreach {$_.ToString().split(" ")[3]} |
foreach {
$sessions += $_
View Export all Exchange mailboxes
# Then this in Exchange Management Shell
$Location = "\\server\pstexport"
New-Item -path $Location -name "migrate.txt" -type File -force
Add-Content "$Location\migrate.txt" "datasourceuser,destinationuser"
# Create a hash table of Exchange mailboxes
$mailboxes = @{}
Get-Mailbox | Select-Object name, alias |
ForEach-Object { $mailboxes.Add($_.name, $_.alias) }
View Gluster Volume
$ sudo gluster volume info
Volume Name: data
Type: Replicate
Volume ID: 7ac35911-b9c2-4f20-a226-65a6173dafb3
Status: Started
Number of Bricks: 1 x 2 = 2
Transport-type: tcp
Bricks:
Brick1: gluster1:/data
View gist:3112465
{
"log": {
"version": "1.2",
"creator": {
"name": "WebInspector",
"version": "536.11"
},
"pages": [],
"entries": [
{