Skip to content

Instantly share code, notes, and snippets.

@shagamemnon
shagamemnon / wsl2-network.ps1
Created February 10, 2023 16:46 — forked from xmeng1/wsl2-network.ps1
WSL2 Port forwarding port to linux
$remoteport = bash.exe -c "ifconfig eth0 | grep 'inet '"
$found = $remoteport -match '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}';
if( $found ){
$remoteport = $matches[0];
} else{
echo "The Script Exited, the ip address of WSL 2 cannot be found";
exit;
}
@shagamemnon
shagamemnon / static_ip.sh
Last active October 5, 2020 02:17 — forked from RichardBronosky/static_ip.sh
Script to generate /etc/dhcpcd.conf for static IP on Raspbian Raspberry Pi
#!/bin/bash -e
sudo cp /etc/dhcpcd.conf /etc/dhcpcd.conf.backup
if [[ $# -ne 0 ]]; then
cat<<EOF
Usage:
$0
DEV=eth0 $0
@shagamemnon
shagamemnon / dig.md
Last active April 24, 2020 18:15 — forked from tuksik/dig_cs.sh
Frank's dig cheat sheet
# force recursion back to root nameservers (helpful for bypassing caches)
dig www.cloudflare.com A +trace

# get the address(es) for yahoo.com
dig yahoo.com A +noall +answer

# get a list of yahoo's mail servers
dig yahoo.com MX +noall +answer
@shagamemnon
shagamemnon / getZones.sh
Last active January 17, 2020 10:26 — forked from cjus/jsonval.sh
Extract a JSON value from a BASH script
#!/bin/bash
function jsonval {
temp=`echo $json | sed 's/\\\\\//\//g' | sed 's/[{}]//g' | awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]}' | sed 's/\"\:\"/\|/g' | sed 's/[\,]/ /g' | sed 's/\"//g' | grep -w $prop`
echo ${temp##*|}
}
json=`curl -s -X GET https://api.cloudflare.com/client/v4/zones?account.name=$ACCT_NAME&page=1&per_page=1000&order=status&direction=desc&match=all`
prop='profile_image_url'
picurl=`jsonval`
@shagamemnon
shagamemnon / install_node.sh
Last active July 13, 2018 03:05 — forked from carlosvillu/install_node.sh
Configure NodeJs + NPM + NGINX
#!/bin/bash
NODE_VERSION=0.4.10
NPM_VERSION=1.0.22
sudo apt-get update
sudo apt-get install -y build-essential git-core nginx libssl-dev pkg-config curl
# Install node
mkdir -p $HOME/local/node
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
@shagamemnon
shagamemnon / gulpfile.babel.js
Created October 16, 2017 03:34 — forked from nicekiwi/gulpfile.babel.js
New ES6 project with Babel, Browserify & Gulp + Bundling/Watching Multiple Files
import gulp from 'gulp';
import sourcemaps from 'gulp-sourcemaps';
import buffer from 'gulp-buffer';
import uglify from 'gulp-uglify';
import tap from 'gulp-tap';
import browserify from 'browserify';
import babel from 'babelify';
gulp.task('build', () => {