# Procedure to copy mp3 files from Youtube playlist to Android smartphone
# Prerequisites: Ubuntu 17.10, bash shell, mp3gain, parallel (to use multi-core processors)
# Prerequisites: Google Chrome Web browser in Ubuntu, AirDroid on Android smartphone

#VARIABLES
TOOL=youtube-dl
INSTALLDIR=~/$TOOL

# install mp3gain (if not installed)
if ! type "mp3gain" > /dev/null; then
sudo DEBIAN_FRONTEND=noninteractive add-apt-repository --yes ppa:flexiondotorg/audio
sudo DEBIAN_FRONTEND=noninteractive apt update
sudo DEBIAN_FRONTEND=noninteractive apt install --yes --force-yes   aacgain mp3gain
  else
  echo "mp3gain installed"
fi

# install parallel (if not installed)
if ! type "parallel" > /dev/null; then
sudo DEBIAN_FRONTEND=noninteractive apt update
sudo DEBIAN_FRONTEND=noninteractive apt install --yes --force-yes   parallel
  else
  echo "parallel installed"
fi

mkdir $INSTALLDIR
rm $INSTALLDIR/$TOOL
wget https://yt-dl.org/downloads/latest/$TOOL -O $INSTALLDIR/$TOOL
chmod +x $INSTALLDIR/$TOOL

echo -n "Enter Youtube playlist to convert to mp3: " 
read URL
PLAYLISTNAME=`$INSTALLDIR/$TOOL --flat-playlist --no-check-certificate  $URL | egrep -v "just" | egrep "Downloading playlist" | head -n1 | cut -d":" -f2`
PLAYLISTDIR=$(echo $PLAYLISTNAME | tr -d ' '| tr -d '&')

mkdir $INSTALLDIR/$PLAYLISTDIR
cd $INSTALLDIR/$PLAYLISTDIR
$INSTALLDIR/$TOOL --postprocessor-args "-threads 6" --no-check-certificate -v  --extract-audio --audio-format mp3 -i  $URL
# normalize volume (run 3 times in case mp3gain skips treatment of files during first 2 attempts)
find . -type f | parallel -X "xargs mp3gain -r -T"
find . -type f | parallel -X "xargs mp3gain -r -T"
find . -type f | parallel -X "xargs mp3gain -r -T"

echo "Temporarily disable all extensions in Google Chrome webbrowser and reboot your Android smartphone before attempting the .mp3 file transfer from Ubuntu to Android via AirDroid"
echo "The Mozilla Firefox web browser is not (yet) compatible with AirDroid. You have to use Google Chrome."
Advertisements
sudo apt update
sudo apt install git
cd
rm -rf spectre-meltdown-checker
git clone https://github.com/speed47/spectre-meltdown-checker.git
cd spectre-meltdown-checker
chmod +x spectre-meltdown-checker.sh
sudo ./spectre-meltdown-checker.sh

grep CONFIG_PAGE_TABLE_ISOLATION=y /boot/config-`uname -r` && echo "patched :)" || echo "unpatched :("
grep cpu_insecure /proc/cpuinfo && echo "patched :)" || echo "unpatched :("
dmesg | grep "Kernel/User page tables isolation: enabled" && echo "patched :)" || echo "unpatched :("
uname -a
#############################################################################################################################
# Procedure for installing ReactOS in stand-alone HVM in Qubes OS 3.2
#############################################################################################################################
# Prerequisites: Qubes OS 3.2, PC with at least 4 GB of RAM
#############################################################################################################################
# In dom0, first create a stand-alone HVM called reactos using this command:
qvm-create -H -m 1024 --label=blue reactos
#############################################################################################################################
# Inside AppVM <name_of_AppVM> in Qubes OS 3.2, download following compressed ReactOS installation iso file to /tmp directory:
cd /tmp; wget https://iso.reactos.org/bootcd/reactos-bootcd-0.4.8-dev-99-g23bc0b5-x86-gcc-lin-dbg.7z
# decompress .7z file using unp or another tool that can decompress 7zip files:
unp /tmp/reactos-bootcd-0.4.8-dev-99-g23bc0b5-x86-gcc-lin-dbg.7z
mv /tmp/reactos-bootcd-0.4.8-dev-99-g23bc0b5-x86-gcc-lin-dbg.iso /tmp/reactos.iso
#############################################################################################################################
# in dom0, run this command, replacing <name_of_AppVM> with actual name of AppVM where ReactOS .iso image was downloaded:
qvm-start reactOS --cdrom <name_of_AppVM>:/tmp/reactos.iso
# Keep VESA display resolution at 800x600x32 during install to avoid boot issues later on
# Make sure to select the optimal keyboard layout settings for your country and keyboard
#############################################################################################################################
# To increase the security of the ReactOS HVM, apply following firewall settings to the reactos HVM:
# Deny all network access,except for DNS queries, https via tcp and http via tcp
#############################################################################################################################
# !!! Do NOT manually install any Windows PV drivers from xenproject.org, as it will cause boot errors in the ReactOS HVM !!!
#############################################################################################################################
# Issues:
############################################################################################################################# 
# Sound output not working
# Mouse tracking issue where mouse pointer position is not synchronized with Dom0 mouse pointer
# Excessive CPU usage when using newest Opera web browser, but Youtube works using Opera and 4 virtual CPU cores
# Mozilla Firefox crashes when trying to access Youtube website (severe bug)
# Install of Windows PV drivers from xenproject.org within reactos HVM -> causes boot errors in ReactOS HVM -> so don't do it
# Choosing a lower RAM setting than 1024 MB for the ReactOS HVM or choosing a screen resolution higher than 800x600x32 
# during install may cause ReactOS to fail to boot or show any icons on the desktop
# Only attempt to increase screen resolution via ReactOS control panel (not any other way) after install is finished
# Etc...
#############################################################################################################################
# enable new Quad9 (9.9.9.9) DNS and DNSSEC service 
# in Ubuntu 17.10 64-bit using a bash shell script
sudo apt purge unbound
LogTime=$(date '+%Y-%m-%d_%Hh%Mm%Ss')
cp /etc/resolv.conf $HOME/resolv.conf_$LogTime
cp /etc/nsswitch.conf $HOME/nsswitch.conf_$LogTime
cp /etc/systemd/resolved.conf $HOME/resolved.conf_$LogTime

sudo service resolvconf stop
sudo update-rc.d resolvconf remove
cp /etc/resolv.conf /tmp/resolv.conf
grep -v nameserver /tmp/resolv.conf > /tmp/resolv.conf.1
echo 'nameserver 9.9.9.9' >> /tmp/resolv.conf.1
sudo cp /tmp/resolv.conf.1 /etc/resolv.conf
sudo service resolvconf start

# enable systemd caching DNS resolver
rm /tmp/nsswitch.conf
rm /tmp/nsswitch.conf.1
cp /etc/nsswitch.conf /tmp/nsswitch.conf
grep -v hosts /tmp/nsswitch.conf > /tmp/nsswitch.conf.1
# dns must be mentioned in next line, or else wget does not work
echo 'hosts: files mdns4_minimal [NOTFOUND=return] resolv dns myhostname mymachines' >> /tmp/nsswitch.conf.1
sudo cp /tmp/nsswitch.conf.1 /etc/nsswitch.conf

# set DNS server to 9.9.9.9
rm /tmp/resolved.conf
rm /tmp/resolved.conf.1
cp /etc/systemd/resolved.conf /tmp/resolved.conf
grep -v DNS /tmp/resolved.conf > /tmp/resolved.conf.1
# enable new Quad9 (9.9.9.9) DNS and DNSSEC service
# https://arstechnica.com/information-technology/2017/11/new-quad9-dns-service-blocks-malicious-domains-for-everyone/
echo 'DNS=9.9.9.9' >> /tmp/resolved.conf.1
echo 'DNSSEC=yes' >> /tmp/resolved.conf.1
sudo cp /tmp/resolved.conf.1 /etc/systemd/resolved.conf
sudo systemd-resolve --flush-caches
sudo systemctl restart systemd-resolved
sudo systemd-resolve --flush-caches
sudo systemd-resolve --status

# It is probably also necessary to manually set
# the DNS server to 9.9.9.9 in the router's configuration
# and in the NetworkManager GUI

# test DNSSEC validation using dig command-line tool and using DNS server 9.9.9.9:
# see: https://docs.menandmice.com/display/MM/How+to+test+DNSSEC+validation
dig pir.org +dnssec +multi
cd /tmp
rm *.deb
wget --no-check-certificate https://vivaldi.com/download/
wget --no-check-certificate `grep deb index.html |grep amd64|cut -d"\"" -f4`
sudo dpkg -i vivaldi*.deb
sudo apt-get install -f
# .R script showing capabilities of sparklyr R package
# Prerequisites before running this R script: 
# Ubuntu 16.04.3 LTS 64-bit, r-base (version 3.4.1 or newer), 
# RStudio 64-bit version, libssl-dev, libcurl4-openssl-dev, libxml2-dev
install.packages("httr")
install.packages("xml2")
# New features in sparklyr 0.6:
# https://blog.rstudio.com/2017/07/31/sparklyr-0-6/
install.packages("sparklyr")
install.packages("dplyr")
install.packages("ggplot2")
install.packages("tidyr")
library(sparklyr)
library(dplyr)
library(ggplot2)
library(tidyr)
set.seed(100)
# sparklyr cheat sheet: https://github.com/rstudio/cheatsheets/raw/master/source/pdfs/sparklyr.pdf
# dplyr+tidyr: https://www.rstudio.com/wp-content/uploads/2015/02/data-wrangling-cheatsheet.pdf
# sparklyr currently (2017-08-19) only supports Apache Spark version 2.2.0 or older
# Install Spark locally:
sc_version <- "2.2.0"
spark_install(sc_version)
config <- spark_config()
# number of CPU cores to use:
config$spark.executor.cores <- 6
# amount of RAM to use for Apache Spark executors:
config$spark.executor.memory <- "4G"
# Connect to local version:
sc <- spark_connect (master = "local",
 config = config, version = sc_version)
# Copy data to Spark memory:
import_iris <- sdf_copy_to(sc, iris, "spark_iris", overwrite = TRUE) 
# partition data:
partition_iris <- sdf_partition(import_iris,training=0.5, testing=0.5) 
# Create a hive metadata for each partition:
sdf_register(partition_iris,c("spark_iris_training","spark_iris_test")) 
# Create reference to training data in Spark table
tidy_iris <- tbl(sc,"spark_iris_training") %>% select(Species, Petal_Length, Petal_Width) 
# Spark ML Decision Tree Model
model_iris <- tidy_iris %>% ml_decision_tree(response="Species", features=c("Petal_Length","Petal_Width")) 
# Create reference to test data in Spark table
test_iris <- tbl(sc,"spark_iris_test") 
# Bring predictions data back into R memory for plotting:
pred_iris <- sdf_predict(model_iris, test_iris) %>% collect
pred_iris %>%
 inner_join(data.frame(prediction=0:2,
 lab=model_iris$model.parameters$labels)) %>%
 ggplot(aes(Petal_Length, Petal_Width, col=lab)) +
 geom_point() 
spark_disconnect(sc)
cd
sudo apt update
sudo apt install cmake build-essential
sudo apt install checkinstall git
sudo apt remove hashcat
sudo apt build-dep hashcat
sudo rm -rf hashcat/
git clone https://github.com/hashcat/hashcat.git
cd hashcat
git submodule update --init
sudo make
sudo checkinstall
hashcat --version
# hashcat version should be v3.5.0 or newer