Skip to content

Instantly share code, notes, and snippets.

View WyrdNexus's full-sized avatar
🏡
🖥🖥🖥

Tony Chiboucas WyrdNexus

🏡
🖥🖥🖥
View GitHub Profile
@WyrdNexus
WyrdNexus / odessia-color.scss
Last active July 3, 2017 05:56
odessia-color
$main: #777;
$prime: #447766;
@WyrdNexus
WyrdNexus / simplescraper-min.js
Last active April 25, 2018 23:43
Javascript SimpleScraper Bookmarklet
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
@WyrdNexus
WyrdNexus / charCount.js
Created August 17, 2017 23:52
jQuery contents character count (all children)
$.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 {
@WyrdNexus
WyrdNexus / gist:282b1028e32521472c0e81ae838f38f5
Last active July 6, 2018 19:13
basic linux CLI cheatsheat
# 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'
@WyrdNexus
WyrdNexus / Microsoft.PowerShell_profile.ps1
Created November 6, 2018 01:47
Powershell CLI customizer
# 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)
@WyrdNexus
WyrdNexus / comp
Created April 10, 2020 17:24
Win Dev with Vagrant Linux Composer modules: don't break the git
#!/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.
@WyrdNexus
WyrdNexus / cmsad.sh
Last active May 29, 2020 18:11
Quick safe ssh user
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
@WyrdNexus
WyrdNexus / stringify.js
Created November 19, 2022 09:20 — forked from bennettmcelwee/stringify.js
Version of JSON.stringify limitied to a specific depth.
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'