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 | |
TargetDir="*" | |
DateStamp=$(date +"%Y%m%d"); | |
for Dir in $(find $TargetDir* -maxdepth 0 -type d ); | |
do | |
FolderName=$(basename $Dir); | |
cd $FolderName | |
pwd |
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 | |
# | |
# Automatically add branch name and branch description to every commit message except merge commit. | |
# Prefix commit messages with "[US1234]: "" | |
# | |
COMMIT_EDITMSG=$1 | |
addBranchName() { | |
branchPath=$(git symbolic-ref -q HEAD) |
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
set hlsearch | |
set smartindent | |
set shiftwidth=3 | |
set tabstop=3 | |
set expandtab | |
set softtabstop=3 | |
set expandtab | |
set shiftround | |
set autoindent | |
set copyindent |
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
[ | |
{ "keys": ["super+v"], "command": "paste_and_indent" }, | |
{ "keys": ["super+shift+v"], "command": "paste" }, | |
{ "keys": ["control+shift+w"], "command": "close_all" }, | |
{ "keys": ["enter"], "command": "noop", "context": | |
[ | |
{ "key": "auto_complete_visible" }, | |
{ "key": "setting.auto_complete_commit_on_tab", "operand": false } | |
] | |
}, |
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 ruby | |
require 'json' | |
p_main = `ps` | |
p_all = `ps -a` | |
users = `who` | |
data = { | |
:local => `ps`.split("\n").size - 1, | |
:tty => `ps a`.split("\n").size - 1, | |
:non_tty => `ps x`.split("\n").size - 1, | |
:total => `ps -A`.split("\n").size - 1 |
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 ruby | |
require 'json' | |
memstr = `free` | |
memPieces = memstr.split("\n")[1].split(" ") | |
memData = { | |
:available => (100*memPieces[1].to_f/1000).round/100.0, | |
:used => (100*memPieces[2].to_f/1000).round/100.0, | |
:free => (100*memPieces[3].to_f/1000).round/100.0, | |
:shared => (100*memPieces[4].to_f/1000).round/100.0, | |
:buffers => (100*memPieces[5].to_f/1000).round/100.0, |
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 ruby | |
require 'json' | |
cpu = `mpstat -P ALL` | |
cpuLines = cpu.split("\n")[3..-1] | |
max = 0 | |
cpuData = cpuLines.map{|s| [s.split(" ")[2], s.split(" ")[3]]}.reduce({}) do |acc, s| | |
key = s[0] == 'all' ? 'total' : "cpu#{s[0]}" | |
acc[key] = s[1].to_f unless key == 'total' | |
max = [max, acc[key]].max unless key == 'total' | |
acc |
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 ruby | |
require 'json' | |
time = Time.new | |
data = { | |
:general_state => 1, # TODO: Fancy logic to set based on value | |
:year => time.year % 100, | |
:month => time.month, | |
:day => time.day, | |
:hour => time.hour, | |
:minute => time.min |
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 ruby | |
require 'json' | |
temps = `sensors` | |
tempLines = temps.split("\n").select{|l| l.include?('Core') } | |
max = 0 | |
tempData = tempLines.map{|l| [ l.split(':')[0].split(' ').join(''), l.split('+')[1].split('C')[0][0..-2] ] }.reduce({}) do |acc, l| | |
acc[l[0]] = l[1].to_f | |
max = [acc[l[0]], max].max | |
acc | |
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
#!/usr/bin/env ruby | |
require 'json' | |
me = `nmap --iflist | grep eth0` | |
myIp = me.split("\n")[0].split(' ')[2] | |
devices = `nmap -sP #{myIp}` | |
deviceCount = devices.split("\n").select{|l| l.include?('Host is up') }.size | |
#devices = `sudo nmap -sP #{myIp}` | |
#deviceCountSudo = devices.split("\n").select{|l| l.include?('Host is up') }.size |
OlderNewer