Skip to content

Instantly share code, notes, and snippets.

@fcenobi
fcenobi / argparse.sh
Last active July 30, 2022 01:20 — forked from mangalbhaskar/argparse.sh
key value parser for shell script for bash shell
declare -A args
while [[ "$#" > "0" ]]; do
case "$1" in
(*=*)
_key="${1%%=*}" && _key="${_key/--/}" && _val="${1#*=}"
args[${_key}]="${_val}"
# (>&2 echo -e "key:val => ${_key}:${_val}")
;;
esac
shift
@fcenobi
fcenobi / ffserver.conf
Created December 17, 2021 08:29 — forked from peterhellberg/ffserver.conf
MJPEG stream from Webcam using FFServer and FFMpeg
HTTPPort 8090
HTTPBindAddress 0.0.0.0
MaxHTTPConnections 200
MaxClients 100
MaxBandWidth 500000
CustomLog -
<Feed camera.ffm>
File /tmp/camera.ffm
FileMaxSize 200M
@fcenobi
fcenobi / recvlkv373.py
Created December 17, 2021 06:21 — forked from danielkucera/recvlkv373.py
./recvlkv373.py 226.2.2.2 2068 out.mjpeg
#!/usr/bin/env python
import socket
import binascii
import sys
def main():
MCAST_GRP = sys.argv[1]
MCAST_PORT = int(sys.argv[2])
@fcenobi
fcenobi / vmware-no-vmem.md
Created September 26, 2021 23:38 — forked from extremecoders-re/vmware-no-vmem.md
Boost VMWare Performance by disabling vmem files.

Prevent creation of vmmem files in VMware (Windows)

Issue

VMWare creates .vmem files to back the guest RAM. On the host this causes disk thrashing especially during powering on and off the guest.

Solution

Add the following lines to the .vmx file to prevent creation of .vmem files. This will reduce disk IO and VM performance will improve especially on non-SSD disks.

curl https://raw.githubusercontent.com/fcenobi/script/master/etc/profile.d/aliases.sh > /etc/profile.d/aliases.sh && source /etc/profile.d/aliases.sh
@fcenobi
fcenobi / dev_signed_cert.sh
Created October 10, 2020 06:53 — forked from dobesv/dev_signed_cert.sh
Script to create (1) a local certificate authority, (2) a host certificate signed by that authority for the hostname of your choice
#!/usr/bin/env bash
#
# Usage: dev_signed_cert.sh HOSTNAME
#
# Creates a CA cert and then generates an SSL certificate signed by that CA for the
# given hostname.
#
# After running this, add the generated dev_cert_ca.cert.pem to the trusted root
# authorities in your browser / client system.
#
@fcenobi
fcenobi / install-prereq.ps1
Last active November 9, 2022 23:56
install winget on windows 10 from powershell
function script-from-github ($weburl) {
$ScriptFromGitHub = Invoke-WebRequest $weburl -UseBasicParsing
Invoke-Expression $($ScriptFromGitHub.Content)
}
$weburl = https://gist.githubusercontent.com/fcenobi/502a16e3dc7f97b2b00afd29f87a1025/raw/cc599e096c29a18b398a82c5b3258175bdee0aa8/install-winget.ps1
script-from-github $weburl
taskkill /F /IM explorer.exe
@fcenobi
fcenobi / export_win_env_var.sh
Created August 21, 2020 21:30 — forked from macchaberrycream/export_win_env_var.sh
export win's environment variable to WSL environment variable
conv_brackets_uscore() {
echo $1 | sed -E 's/[][{}()]/_/g'
return 0
}
conv_path_win_linux() {
local _path
local _del_trailing_slash_path
@fcenobi
fcenobi / wsl2-portforward.ps1
Created August 21, 2020 19:58 — forked from hoonoh/wsl2-portforward.ps1
wsl2 port forwarding script
$remoteAddr = bash.exe -c "ifconfig eth0 | grep 'inet '"
$found = $remoteAddr -match '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}';
if( $found ){
$remoteAddr = $matches[0];
echo $remoteAddr;
} else{
echo "The Script Exited, the ip address of WSL 2 cannot be found";
exit;
}
@fcenobi
fcenobi / ApacheGuacUserMapping.ps1
Created August 1, 2020 03:12 — forked from quonic/ApacheGuacUserMapping.ps1
Appache Guacamole user-mappings.xml file generator for current network
. .\NewXMLDocument.ps1
$rdp_domainname = "MicrosoftAccount"
$rdp_username = "fred"
$ssh_username = "fred"
$vnc_username = "fred"
$rdp_password = "changeme!"
$ssh_password = "changeme!"
$vnc_password = "changeme!"