Skip to content

Instantly share code, notes, and snippets.

View nicholasadamou's full-sized avatar
🤓
working hard to make the world better with software

Nicholas Adamou nicholasadamou

🤓
working hard to make the world better with software
View GitHub Profile
@nicholasadamou
nicholasadamou / index.js
Created September 18, 2022 01:39
Convert HTML to HTML Entities
const toHTMLEntities = (html) => {
let result = '';
for (let i = 0; i < html.length; i++) {
result += "&#x" + html[i].charCodeAt(0).toString(16) + ";";
}
return result;
}
@nicholasadamou
nicholasadamou / scan.sh
Created September 2, 2019 11:56
Scan for nearby networks every 10 seconds on MacOS
#!/bin/bash
while true
do
sudo /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -s
sleep 10
done
# Increase history
$MaximumHistoryCount = 10000
# Produce UTF-8 by default
$PSDefaultParameterValues["Out-File:Encoding"]="utf8"
# Show selection menu for tab
Set-PSReadlineKeyHandler -Chord Tab -Function MenuComplete
# Helper Functions
@nicholasadamou
nicholasadamou / boxstarter
Last active February 16, 2019 12:45
Base Windows Configuration
### Base Windows Configuration ###
<#
The command to run, built from the raw link of this gist
Win+R
iexplore http://boxstarter.org/package/url?<RAW GIST LINK>
OR (if you don't like the way the web launcher force re-installs everything)
Create another script like the following to install and run the gist:
@nicholasadamou
nicholasadamou / install.sh
Last active January 26, 2019 15:15
Install a DMG file via CLI.
#!/bin/bash
# see: https://apple.stackexchange.com/a/311511/291269
function install_dmg {
set -x
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Initialize a variable for the URL to the '.dmg'
@nicholasadamou
nicholasadamou / setup.sh
Last active December 14, 2018 02:06
Reset Parallels Desktop's trial and generate a casual email address to register a new user.
#!/bin/sh
# Reset Parallels Desktop's trial and generate a casual email address to register a new user
sudo rm /private/var/root/Library/Preferences/com.parallels.desktop.plist /Library/Preferences/Parallels/licenses.xml
jot -w pdu%d@gmail.com -r 1
@nicholasadamou
nicholasadamou / add-apt-repository
Last active August 21, 2018 16:33
Utility to add PPA repositories in your debian machine.
#!/bin/bash
if [ $# -eq 1 ]
NM=`uname -a && date`
NAME=`echo $NM | md5sum | cut -f1 -d" "`
then
ppa_name=`echo "$1" | cut -d":" -f2 -s`
if [ -z "$ppa_name" ]
then
echo "PPA name not found"
else
@nicholasadamou
nicholasadamou / xfce4.sh
Created May 23, 2018 12:57
Install xfce4 on Kali Linux WSL to be used with an XRDP client on Windows.
#!/bin/bash
echo "[+] Installing XFCE4, this will take a while"
sudo apt update
sudo apt dist-upgrade -y --force-yes
sudo apt --yes --force-yes install kali-desktop-xfce xorg xrdp
echo "[+] Configuring XRDP to listen on port 3390 (but not starting the service)..."
echo "[+] To start the service run: sudo /etc/init.d/xrdp start"
sudo sed -i 's/port=3389/port=3390/g' /etc/xrdp/xrdp.ini
sudo echo "alias startx=\"sudo /etc/init.d/xrdp start\"" > ~/.bash_aliases
sudo echo "alias stopx=\"sudo /etc/init.d/xrdp stop\"" > ~/.bash_aliases
@nicholasadamou
nicholasadamou / install.sh
Created May 20, 2018 13:45
Installs Sublime Text 3 on a Linux-based system.
# see: https://askubuntu.com/a/954348/552275
wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -
# Stable Channel
echo "deb https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list
# Dev Channel
# echo "deb https://download.sublimetext.com/ apt/dev/" | sudo tee /etc/apt/sources.list.d/sublime-text.list
@nicholasadamou
nicholasadamou / setup.sh
Created April 29, 2018 23:08
Start's the FruityWiFi daemon + web-interface.
#!/bin/bash
HTTP_PORT=8000
HTTPS_PORT=8443
ipaddr="$(hostname -I | cut -d ' ' -f1)"
/etc/init.d/fruitywifi restart && /etc/init.d/php7.0-fpm restart
sudo fuser -k "$HTTP_PORT"/tcp &>/dev/null
sudo fuser -k "$HTTPS_PORT"/tcp &>/dev/null