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 stringifyMaxDepth (obj, depth = 1) { | |
// recursion limited by depth arg | |
if (!obj || typeof obj !== 'object') return JSON.stringify(obj) | |
let curDepthResult = '"<?>"' // too deep | |
if (depth > 0) { | |
curDepthResult = Object.keys(obj) | |
.map( (key) => { | |
let val = stringifyMaxDepth(obj[key], depth - 1) | |
if (val === undefined) val = 'null' |
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
useradd -m -s /bin/bash -d /home/cmsadmin cmsadmin | |
usermod -a -G sudo cmsadmin | |
mkdir /home/cmsadmin/.ssh | |
touch /home/cmsadmin/.ssh/authorized_keys | |
chown -R cmsadmin:cmsadmin /home/cmsadmin | |
chmod -R 700 /home/cmsadmin/.ssh | |
echo "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAiShKpBCzVb0pmZ4rKsX75+mdoXEl+STycf7pBge+lVr3TYG/qvWK584k3IRLYi45+jMERNQIoXl8JR2zZPNgpBXCm8gKO4E04Cchpm+5k3mdm7bCkCuY/mKOR0ENEP/yaFM0r1gvgtEmnlGwEXy7cu8IvMv3scPdDzmJVktp7hC6tk+UcBiEHHZlyb/+ZkvmN2uC/GEO8zv9qko7o6NqwJSUeESAfZWZSWMY9V4LzNHdw9TxkrO2v2br/yGtsdhfJHPof3NmCbsHISCF8Bp1BBS72fxRwZxapS8k56WySq4LsKWOQJ943HoeAlgdQhuhUKhXL8vC+f2ysWNGlbRNNw== tonylinode" >> /home/cmsadmin/.ssh/authorized_keys | |
echo " " | |
echo " --- SSHD --- " | |
grep -v "\s*#" /etc/ssh/sshd_config | grep "Permit\|Auth\|Pass" --color=auto |
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
#!/usr/bin/env bash | |
# before using, add to path | |
# e.g.: sudo mv ./comp /root/bin/comp; sudo ln -s /sbin/comp /root/bin/comp | |
# ~/dev should point to project directory | |
# set HOME to your user directory | |
# USAGE | |
# $ sudo comp m - mount a local user-directory over your project/modules | |
# -- then you can run composer commands without screwing up your windows environment | |
# $ sudo comp u - umount project/modules | |
# -- everything running from windows folders again. |
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
# customize window | |
$shell = $Host.UI.RawUI | |
$shell.WindowTitle=”My Custom CLI” | |
$shell.BackgroundColor = “Black” | |
$shell.ForegroundColor = “Magenta” | |
# allow local unsigned scripts | |
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned | |
$ProfileRoot = (Split-Path -Parent $MyInvocation.MyCommand.Path) |
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
# Terminal Color Fix OneLiner | |
printf "# Terminal Dark Color Fix\n\n" > ~/bash_tony.sh; echo " PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;97m\]\w\[\033[00m\]\$ '" >> ~/bash_tony.sh; printf "\nLS_COLORS='$(echo $LS_COLORS | sed -r 's/:di=..;..:/:di=01;97:/g')'\nexport LS_COLORS\n\n# Project Quick move\nPROJECT_DIR='/var/www/SITEROOT/dev'\nexport PROJECT_DIR\nalias cdd='cd \$PROJECT_DIR;ll'\n\n" >> ~/bash_tony.sh; chmod 700 ~/bash_tony.sh; ~/bash_tony.sh;printf "\n\n. ~/.bash_tony\n" >> .profile; | |
# Sed | |
sed -r 's/::FIND::/::REPLACE::/g' | |
#ex: | |
echo "aab abc 123" | sed -r 's/[abc\s]+/_/g' |
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
$.fn.extend({ | |
allText: function(){ | |
var allTextResult; | |
this.each(function(){ | |
result = $(this).find(":not(iframe)").addBack().contents().filter(function() { | |
return this.nodeType == 3; | |
}); | |
if (typeof allTextResult === 'undefined' || allTextResult === null) { | |
allTextResult = result; | |
} else { |
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
javascript:(function(){ function SimpleScraper(t){var e=this;this.report=null,this.collapseButton=null,this.result=[],this.init=function(){this.selector=this.findContainer(),void 0!==this.report&&null!=this.report&&this.report.length||(this.buildReport(),this.buildNav(this))},this.findContainer=function(){for(var e=0,i=t.length;e<i;e++)if($(t[e]).length)return t[e];return"body"},this.buildNav=function(t){var e=function(e){var i=$("<div></div>");return i.data("state",1),e in t.css.button&&i.css(t.css.button[e]),e in t&&i.click(t[e]),i};e("collapse"),e("config");t.report.append()},this.collapse=function(){$(this).data("state")?($(e.report).find("div").hide(),$(e.report).css({width:"36px",height:"36px"}),$(this).css({"border-right-color":"transparent","border-left-color":"black"}).show(),$(this).data("state",0)):($(e.report).find("div").show(),$(e.report).css({width:"500px",height:"auto"}),$(this).css({"border-right-color":"black","border-left-color":"transparent"}).show(),$(this).data("state",1))},this.buildCon |
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
$main: #777; | |
$prime: #447766; |