Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Joe Huss detain

View GitHub Profile
View index.html
<div id="textOutput" style="white-space: pre;">//////////////////////////////////////////////////////////*///**////////////////////////////////////////////////////////////////////////////////////////////////////////////*/**********************************************************************... ..****....*******.*************************************... . . ......<br>//////////////////////////////////////////**////******///*********//////////////////////////////////////////////////////////////////////////////////*////////////////////*///*****/************************************************************. . .... ..*..........*********************************************......... .............<br>/////////////////////////////////////////***////*******///*******///////////////////////////////////////////////////////////////////////////////////*/////////////////**///*///*///***********************************************************.. .... .***........*********************************
View rebuild_svn_history.sh
#!/bin/bash
#rm -rf /var/lib/submin/svn/cisco_parser; cp -a cisco_parser /var/lib/submin/svn/ ; submin2-admin /var/lib/submin unixperms fix
read -p "username:password for svn repo" CURLAUTH
#export CURLAUTH="username:password"
IFS="
"
set -x
for file in *cisco.php; do
for rev in $(svn log "$file" |grep -A1 -- "----------------" |grep "^r"| cut -d" " -f1 | cut -c2-); do
echo "$file $rev";
@detain
detain / convert_db_to_utf8.sh
Created Aug 9, 2018
converts mysql data to character set utf8mb4 set / collation utf8mb4_unicode_ci
View convert_db_to_utf8.sh
#!/bin/bash
function make_mysql_utf8_convert() {
db="$1"
echo "SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci, COLLATION_CONNECTION = utf8mb4_unicode_ci, COLLATION_DATABASE = utf8mb4_unicode_ci, COLLATION_SERVER = utf8mb4_unicode_ci;" > update_utf8.sql;
echo "SET FOREIGN_KEY_CHECKS=0;" >> update_utf8.sql;
echo "ALTER DATABASE ${db} CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;" >> update_utf8.sql;
for t in $(echo "show table status where Engine IS NOT NULL;" | mysql -s "${db}"| awk '{ print $7 " " $1 }' |sort -n | awk '{ print $2 }'); do
echo "ALTER TABLE ${t} CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci$(mysqldump -d "${db}" "$t" | grep "^ *\`"| \
grep -i -E -e "\` (varchar|mediumtext|text|char)" | \
View index.html
<dashboard class="dashboard">
<dashboard-header title="Teb-2 DataCenter">
<dashboard-clock digital="true" binary="true" />
</dashboard-header>
<server-list>
<server v-for="(server, index) in servers" :class="{ 'has-failed': !server.status }" :type="server.type" @click.native="updateServerStatus(index)">
<span slot="name" class="data">{{server.name}}</span>
<span slot="status" class="data signal">{{server.status ? 'ONLINE' : 'OFFLINE'}}</span>
<span slot="adr" class="data">{{server.adr}}</span>
</server>
@detain
detain / generate_chown_fix.sh
Created Dec 22, 2016
Read all files in /etc and generate chown lines for them using the current owner/group (for use on another server whos ownership got messed up):
View generate_chown_fix.sh
find /etc|xargs -n 1 stat -c "chown %U.%G %n;"
@detain
detain / Interactive Customer Feedback Form (For a pet store).markdown
Created Jan 9, 2016
Interactive Customer Feedback Form (For a pet store)
View Interactive Customer Feedback Form (For a pet store).markdown
@detain
detain / gist:c0e135bd64c0ec805487
Created Sep 17, 2015
Changes since we last updated Observium
View gist:c0e135bd64c0ec805487
Changelogs
August 2015 ( 131 commits )
r6802 to 6933
Device Support
Added support for DDN SFA devices
Added support for user/device license graphs for Mitel devices
Added support for Rittal CMC devices including water flow rate sensors
Added support for failover status sensors on Cisco ASAs
Added support for Netgear ReadyDATA OS temperature and fanspeed sensors from READYDATAOS-MIB
Added support for Netgear ReadyNAS temperature and fanspeed sensors from READNAS-MIB
View gist:f44a1b4b8e001917769c
Vagrant.configure(2) do |config|
config.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
vb.customize ["modifyvm", :id, "--nictype1", "virtio"]
end
end
@detain
detain / get_rpmbuild_dir.sh
Created Oct 21, 2014
Getting the correct RPM directory for compiling [for scripting purposes]
View get_rpmbuild_dir.sh
rpmdir="$(grep "^%_topdir" /usr/lib/rpm/macros | sed -e s#"^.*%{getenv:HOME}"#"${HOME}"#g -e s#"^.*%{_usrsrc}"#"/usr/src"#g)";
View xml2array.php
<?php
/**
* xml2array() will convert the given XML text to an array in the XML structure.
* Link: http://www.bin-co.com/php/scripts/xml2array/
* Arguments : $contents - The XML text
* $get_attributes - 1 or 0. If this is 1 the function will get the attributes as well as the tag values - this results in a different array structure in the return value.
* $priority - Can be 'tag' or 'attribute'. This will change the way the resulting array sturcture. For 'tag', the tags are given more importance.
* Return: The parsed XML in an array form. Use print_r() to see the resulting array structure.
* Examples: $array = xml2array(file_get_contents('feed.xml'));
* $array = xml2array(file_get_contents('feed.xml', 1, 'attribute'));
You can’t perform that action at this time.