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 | |
### Run with | |
# while (nc -e info.sh -v -l -p 1025); do sleep 1; done | |
# | |
users() { | |
who | cut -f1 -d ' ' | uniq | awk -v ORS=, '{ print "\042"$1"\042" }' | sed 's/,$//' | |
} |
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 | |
set -x | |
log() { echo $*; } | |
HOSTS="host1 host2" | |
TODAY=$(date +%Y%m%d) | |
YESTERDAY=$(date +%Y%m%d -d '1 day ago') | |
for host in $HOSTS; 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
ctrl.createField = function (e) { | |
e.preventDefault(); | |
ctrl.vm.ContractSectionId = args.contractSection.Id; | |
var saveField = function () { | |
return Field.save(ctrl.vm).result | |
} | |
saveField() |
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
require 'sunspot' | |
require 'sunspot/rails' | |
require 'feedjira/feed' | |
module Sunspot | |
module Feedjira::Feed | |
def self.included(base) | |
base.class_eval do | |
extend Sunspot::Rails::Searchable::ActsAsMethods | |
Sunspot::Adapters::DataAccessor.register(DataAccessor, base) |
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/sh | |
# vim:ts=2:sts=2:sw=2:et:ft=sh: | |
user=$1 | |
home="/home/$user" | |
[ -z "$user" ] && echo "missing user" && exit 1 | |
btrfs subvolume create $home > /dev/null | |
chattr +c $home |
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
# frozen_string_literal: true | |
source "https://rubygems.org" | |
gem "benchmark-ips" | |
gem "rr" | |
gem "mocha" | |
gem "simple_mock" |
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
ruby -ne 'BEGIN{$n=0}; ~/\/(\d+)/ && $n += (2 ** (32 - $1.to_i)); END{puts $n}' |
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/sh | |
# vim:ts=4:sts=4:sw=4:et | |
for d in $(ls /var/lib/libvirt/images/*.qcow2); do | |
grep $d /etc/libvirt/qemu/*.xml >/dev/null || echo $d | |
done |
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/sh | |
(for i in $(ls /etc/libvirt/qemu/*.xml); do xml2 < $i | grep 'memory='; done) | awk -F= '{ sum += $2 } END { print sum / 1024^2 " GB" }' |
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 main | |
import ( | |
"fmt" | |
"net/http" | |
"net/http/cgi" | |
"os" | |
) | |
type Handler func(http.ResponseWriter, *http.Request) |