Old Laptop Into BEST Smart TV / Dual Boot Linux

Video of this here : https://www.youtube.com/watch?v=8SPV1ODAzoc

This is a great way to repurposed an old computer into a smart TV using LibreELEC/Kodi and a full lightweight antiX Linux as a full O.S. This is ½ of a D.I.Y. home smart TV project. The construction of TV mount and floating laptop desk can be found at URL coming soon.

Any data on this hard drive will be deleted.

] INSTALL LibreELEC [

Install LibreELEC, just enough Linux for Kodi. This a fast install and screenshots are attached to assist.

] INSTALL antiX Linux [

There are a few more installation screens after this. They are self explanatory.

] FIXING THE DUAL BOOT [
After antiX Linux has installed when you reboot you will notice grub only has antiX Linux as your choice.

Log into antiX Linux. Go to the command line and install the following.

# sudo apt install grub-customizer

If you followed the instructions and used a clean hard drive for installation the following should be the same.

Let us discover how the hard drives are partitions.

# sudo blkid

You should receive an output like this.

/dev/sda1: SEC_TYPE="msdos" LABEL="System" UUID="8E4B-146C" TYPE="vfat" PARTUUID="5c14207c-01"
/dev/sda2: LABEL="Storage" UUID="c978caa6-e8c0-4d71-812a-83291526fb1f" TYPE="ext4" PARTUUID="5c14207c-02"
/dev/sda3: LABEL="swapantiX" UUID="7308e239-adfe-4313-b589-637802d192f8" TYPE="swap" PARTUUID="5c14207c-03"
/dev/sda4: LABEL="rootantiX19" UUID="051a33f2-a4a3-4db1-a7f7-147aee61cc15" TYPE="ext4" PARTUUID="5c14207c-04"

LibreELEC creates these two partitions /dev/sda1: SEC_TYPE=”msdos” and /dev/sda2: LABEL=”Storage” . The partition labeled “msdos” is for the operating system and “ Storage” is for storage. This is the information we need. Change if yours has a different hard drive partition numbering.

Let us create the Grub entry for LibreELEC. Open and edit 40_custom.

Old Laptop Into BEST Smart TV / Dual Boot

# sudo nano /etc/grub.d/40_custom
menuentry "LibreELEC_Kodi" {
set root=(hd0,1)
linux /KERNEL boot=/dev/sda1 disk=/dev/sda2 quiet
}

“set root=(hd0,1)” is the first hard drive denoted with /dev/sdaX. If it was the second it would look like /dev/sdbX.

“boot=/dev/sda1 disk=/dev/sda2” contains the location of the operating system boot information dev/sda1 and storage dev/sda2 for LibreELEC.

Update Grub.

# sudo update-grub

Move LibreELEC to the top so it boots by default using a graphical user interface.

# sudo grub-customizer

Click on “LibreELEC_Kodi” and use the up arrow at the top to move it below the line labeled “Advanced options for Debian”

Reboot and both operating systems will be present and LibreELEC will be the default O.S. that loads.

Posted in Linux | Tagged , , , , , , | Leave a comment

Map Iteration Array, Use Class No Instantiation

Iterate over a list or array to build a new list or array, using map as the iterator passing the value(s) to a class for computation without instantiating the class. This is a direct violation of Law of Demeter. I did this as an experiment to type less code in JavaScript when I discovered how to use this => . This is replicated with multiple languages such as Ruby, Python, PHP, and Java.

All Various Languages Code Here: ArrayClassMap

JavaScript Original Inspiration :

var aNumList = [ 4, 9, 16, 25];

class doComputations {
constructor ( myValue ) {
this.myValue = myValue;
}

// Getter
get addedValue () {
return this.addValue();
}

addValue(){
return this.myValue + this.myValue;
}

}

console.log ( aNumList.map ( aNums => new doComputations ( aNums ).addedValue ) );

alert ( aNumList.map ( aNums => new doComputations ( aNums ).addedValue ) );

Posted in Java, Javascript, Linux, PHP, Python, Ruby | Leave a comment

Commandline Media Helper

A Python project to edit video, photo and audio using various system calls mostly to FFmpeg.

Examples : Videos | Audio | Photos

Slicing Videos To Time : ./ffmpegHelper.py -s1 v.mov 0:34 0:39 out.mov
Slicing Videos To Range : ./ffmpegHelper.py -s2 v.mov 0:34 0:39 out.mov
Instagram Without Resize : ./ffmpegHelper.py -i1 v.mov 0:34 0:39 720:720:300:0 out.mp4
Instagram -W- Resize No Aud : ./ffmpegHelper.py -i2 v.mov 0:34 0:39 720:720:300:0 out.mp4
Almost Lossless -W- Resize : ./ffmpegHelper.py -i3 v.mov 0:34 0:39 720:720:300:0 out.mp4
Instagram Without Resize : ./ffmpegHelper.py -i4 v.mov 0:34 0:39 720:720:300:0 out.mp4
YouTube Audio Removed : ./ffmpegHelper.py -y1 v.mov 0:34 0:39 out.mp4
YouTube : ./ffmpegHelper.py -y2 v.mov 0:34 0:39 out.mp4
Concat Videos : ./ffmpegHelper.py -c1 out.mp4
Concat Videos Youtube BRND : ./ffmpegHelper.py -c2 out.mp4
Combine Video and Audio : ./ffmpegHelper.py -c3 v.mov out.mp3 out.mkv
Overlay Text/Image 2 Video : ./ffmpegHelper.py -t1 out.mov “Overlayed Text” /pathto/font.ttf out.mp4
Overlay Text To Video : ./ffmpegHelper.py -t2 text.mov “Overlayed Text” /pathto/font.ttf out.mp4
Preview Video : ./ffmpegHelper.py -p v.mov 0:34 0:39 720:720:300:0
Slow Motion : ./ffmpegHelper.py -e1 v.mov 4 out.mp4
Slow Motion No Audio : ./ffmpegHelper.py -e2 v.mov 0:34 0:39 2.5 out.mp4
Black And White : ./ffmpegHelper.py -e3 v.mov 0:34 0:39 out.mp4
Black And White No Audio : ./ffmpegHelper.py -e4 v.mov 0:34 0:39 out.mp4
Extract Single Frame : ./ffmpegHelper.py -e5 v.mov 0:34 image.png
Scale Ratio Width : ./ffmpegHelper.py -e6 v.mov 0:34 0:39 out.mp4
Scale Ratio Width No Audio : ./ffmpegHelper.py -e7 v.mov 0:34 0:39 out.mp4
Scale Ratio Height : ./ffmpegHelper.py -e8 v.mov 0:34 0:39 416 out.mp4
Scale Ratio Height No Audio : ./ffmpegHelper.py -e9 v.mov 0:34 0:39 416 out.mp4
Resize Arbitrary : ./ffmpegHelper.py -e10 v.mov 0:34 0:39 416 416 out.mp4
Resize Arbitrary No Audio : ./ffmpegHelper.py -e11 v.mov 0:34 0:39 416 416 out.mp4
Combine Audio With Image : ./ffmpegHelper.py -e12 i.png a.mp3 out.mp4
Turn Image Into Video : ./ffmpegHelper.py -e13 i.png 5 out.mp4
Overlay Vid/Img On Video : ./ffmpegHelper.py -e14 main.mov overlay.mp4 40 40 out.mp4
Crossfade Video : ./ffmpegHelper.py -e15 vid1.mov vid2.mov 2 out.mp4
Audio Volume : ./ffmpegHelper.py -a1 a.mp3 2 b.mp3
Caption To A Photo : ./ffmpegHelper.py -p1 i.png /pathto/font.ttf “Hello World” out.png
Caption From temp.txt : ./ffmpegHelper.py -p2 #123456 “#344567” /home/lex/share/Mo_De_Studio/audio_blog/Bookerly/Bookerly-Bold.ttf “1280×720” “#123456” 10 out.png
Resize A Photo : ./ffmpegHelper.py -p3 i.png 150X700! out.png
Hint : Use 0 to choose media length example : ./ffmpegHelper.py -p v.mov 0:34 0 720:720:300:0
Hint : To use c1 and c2 the filenames must be sequenced like this you can mix and match suffixes c1.xxx, c2.xxx … c400.xxx
Help : ./ffmpegHelper.py -h

] Install These Dependencies [

apt-get install ffmpeg imagemagick mplayer python3-pip

Install the following helper class for python 3.X.

pip3 install ffmpy

] Source [
https://github.com/MotionDesignStudio/commandlinemediahelper

Posted in Computer programming, ffmpeg, Linux, Python, video editing | Tagged , | Leave a comment

Problem Installing OS X El Capitan

Today’s date is Tue May 30 00:38:02 EDT 2017 and I am I trying to install OS X El Capitan. I encountered the following problem.

“This copy of the Install OS X El Capitan application can’t be verified. It may have been corrupted or tampered with during downloading.”

E1BMF

Solution:

This is the solution.

While in the install process. On the main screen choose “Utilities” from the top menu. Then choose “Terminal”.

In the box that opens type the following.

date 0101010116

Explanation:

This error occurs because OS X El Capitan released on September 30, 2015 does not like the displacement in time from its date of release that you are trying to install it.

Posted in Uncategorized | Tagged , , | Leave a comment

Commandline Words and Topics Research Tool

This is a comandline utility to assist with rapid research. If you are a word smith, enjoy researching topics, definitions, etymology, synonyms, antonyms, acronyms, medical terms, legal terms, text and chat acronyms, and newer words in Urban Dictionary. This application searches 15 different source.

This is a comandline utility to assist with rapid research. If you are a word smith, enjoy researching topics, definitions, etymology, synonyms, antonyms, acronyms, medical terms, legal terms, text and chat acronyms, and newer words in Urban Dictionary. This application searches 15 different source.

Example Searching :

java -cp .:./jsoup-1.10.2.jar DownloadDefinitions “d1” “love”

Output:

SEARCHING : http://www.thefreedictionary.com/love

1. A strong feeling of affection and concern toward another person, as that arising from kinship or close friendship.
2. A strong feeling of affection and concern for another person accompanied by sexual attraction.
3. a. A feeling of devotion or adoration toward God or a god. b. A feeling of kindness or concern by God or a god toward humans. c. often Love Christianity Charity.

Example Searching :

java -cp .:./jsoup-1.10.2.jar DownloadDefinitions “d4” “love”

Output:

SEARCHING : https://en.wikipedia.org/wiki/love

Love is a variety of different feelings, states, and attitudes that ranges from interpersonal affection (“I love my mother”) to pleasure (“I loved that meal”). It can refer to an emotion of a strong attraction and personal attachment.[1] It can also be a virtue representing human kindness, compassion, and affection—”the unselfish loyal and benevolent concern for the good of another”.[2] It may also describe compassionate and affectionate actions towards other humans, one’s self or animals.[3]

Example Help:

java -cp .:./jsoup-1.10.2.jar DownloadDefinitions “help”

Example Compiling:

javac -cp jsoup-1.10.2.jar DownloadDefinitions.java

Source: https://github.com/lindylex/CommandlineWordsAndTopicsResearchTool

Posted in Uncategorized | Leave a comment

Collection of Java Code to Solve Various Tasks

In 250s BCE the sieve of Eratosthenes was discovered to find prime numbers. I implemented two versions of this sieve algorithm. The first uses two procedures/method/subroutines to find all the prime numbers in a range starting from 2 – given number. In this example I use 2 – 2017.

The two method approach reflects how a humyn thinks and would approach solving the problem. The single method approach is a more streamlined approach.

Example:
Execute
java SieveofEratosthenes2
Compile
javac SieveofEratosthenes2.java

More info here: https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes

Code:
https://github.com/lindylex/RandomJavaCode

Output of 2 – 10,000
http://mo-de.net/d/primeNumbers.txt

Prime numbers from 2 – 10,000

BEGIN Double Array Version

2 3 5 7 11 13 17 19 23 29
31 37 41 43 47 53 59 61 67 71
73 79 83 89 97 101 103 107 109 113
127 131 137 139 149 151 157 163 167 173
179 181 191 193 197 199 211 223 227 229
233 239 241 251 257 263 269 271 277 281

FINISH

Posted in Uncategorized | Leave a comment

Google’s Chrome Cast Affect

# GoogleChromeBackgoundAffect
This replicates the fade-out affect of images seen on Google’s Chrome Cast.

Instructions:

This requires a web server that can execute php code. It requires one php script to create an array with the image names.

Images are stored in ”img/bg” directory.

*** VERY IMPORTANT ***
You must have a minimum of four images in that directory.

pocChromeAffect.js :

You can adjust the fade-out rate here and delay between the affect. Change the 3000 for duration of fade-out affect and 9000 for the delay between.

Every 1000 is equal to one second.

$(thisDivIsOnTop).delay( 9000 ).animate({opacity: 0}, 3000,

Demo:

http://mo-de.net/GoogleChromeBackgroundAffect/chromeAffect.html

Bugs:

Image flickers on Firefox. Any help fixing this would be greatly appreciated. I narrowed it down to jQuery’s behavior at the end of changing the opacity.

On Github:
https://github.com/lindylex/GoogleChromeBackgoundAffect

Posted in Uncategorized | Leave a comment

Replicates The Tail Functionality On Unices

This replicates the tail functionality on Unices. One of the functions does a system call to the tail command. I tested it using a text file 1.8M in size.

These are the run times for each function using the same file.

def replicateUnixTail

real 0m0.036s user 0m0.032s sys 0m0.000s

def replicateUnixTail2

real 0m0.046s user 0m0.040s sys 0m0.004s

def replicateUnixTail3

real 0m0.034s
user 0m0.028s
sys 0m0.000s

Example usage:

replicateUnixTail (file_source=”street.txt”, start_from=10, increment_in_bytes=-256 )

replicateUnixTail2 (file_source=”street.txt”, start_from=10, increment_in_bytes=-256 )

replicateUnixTail3 (file_source=”street.txt”, startfrom=-10 )

Source: https://github.com/lindylex/replicateUnixTail

Posted in Uncategorized | Leave a comment

Count Word Frequencies In A Body of Text From A Website

Count Word Frequencies In A Body of Text From A Website

Available on Github:
https://github.com/lindylex/wordFrequencyAndUrlScraper

Description:

This will count the frequency of words in a body of text. It also has the ability to download all the text from an entire website or a single URL. Once the text is downloaded you can analyze the text’s word frequency.

Example usage:

Sample output from Ku Klux Klan’s websites

Word Frequency On Ku Klux Klan’s Websites

#Download a website using the sitemap and display its text without html
example=wordFrequency(url=”http://myurl.net/sitemap.xml”)
example.crawl_sitemap( retry_rate=15)

#Download ALL the pages from a website and display its text without html
example=wordFrequency(url=”http://mustpassarobotsfile.com/”)
example.scrape_all_websites_text( link_regex=’/*’, max_depth=-1, retry_rate = 15, robots_file=’http://mustpassarobotsfile.com/robots.txt’ )

#Download a SINGLE webpage and display its text without html
example=wordFrequency(url=”http://myurl.net/”)
print ( example.display_text_only( ) )

#Download a SINGLE webpage and display its text
example=wordFrequency(url=”http://myurl.net/”)
print ( example.download( num_retries=2 ) )

#Search for specific amount of words left or right of a specified word
example=wordFrequency(file_source=”my_text_file.txt”, number_to_display = 20)
print ( example.get_surrounding_words(“Christmas”, 4, 4) )

The downloaded pages require some additional cleaning.

] Use this to clean data [

This line is an attempt to clean the output in one command.

perl -pe ‘s/<url :::.*?//g’ o3.txt

To remove this > (”, “b’ do below.

sed -re $’s/[(]\’\’, \”b\’//g’ o4.txt

(”, ‘b’

sed -re $’s/[(]\’\’, \’b\’//g’ o5.txt

To remove \\\’

sed -r “s/\\\\\\\’/\’/g” o6.txt

To remove \’

sed -r “s/\\\’/\’/g” o7.txt

] Very Important [

Do not set retry_rate = 15 below 15 you might get banned from a website.

When you scrape an entire website always check to see if they have a robots files and set it like this.

robots_file=’http://mustpassarobotsfile.com/robots.txt

These files are necessary stopwords.txt and default_robots.txt.

] Future Functionality [

– Examine the most common word(s) shared by different outputs?
– Search for a string frequency such “Acrobatic Yoga”
– Count and list how many links a website has
– Search for call to action words
– Search for pronouns to predict the writes gender and mindset

Posted in Computer Forensics, Computer programming, HTML, Linux, Python, regex | Leave a comment

Editing Video With FFMPEG

Slice Video

./ffmpeg-git-20151004-64bit-static/ffmpeg -i myVideo.mov -ss 00:00:14.0 -c copy -t 00:00:6.0 -an slicedVideo.mov 

 

 

-ss 00:00:14.0 – This indicated the starting point in the video where the slice begins.

-t 00:00:6.0 – This indicates how much time after the starting point to include in the slice. If this value is absent ffmpeg will include the remaining of the video from the starting slice time.

Extract Image(s) From Video

./ffmpeg-git-20151004-64bit-static/ffmpeg -i myVideo.mov -vframes 1 -ss 00:00:40 $(date +%Y%m%d-%H%M%S).png 

 

 

This will extract a png files from a video.
-ss 00:00:14.0  –  This indicates the starting point in the video where the image extraction starts.

The output file will look like this.  “20160123-221926.png”

Black and White with No Audio

./ffmpeg-git-20151004-64bit-static/ffmpeg -i myVideo.mov -ss 00:00:14.0 -t 00:00:6.0 -an -vf format=gray,format=yuv422p blackAndWhiteVideo.mov 

 

 

Slow Motion Or Speed Up Video Play Back

./ffmpeg-git-20150610-64bit-static/ffmpeg -i s1.mov -c copy -filter:v "setpts=2.5*PTS" -y s1s.mov

setpts=2.5*PTS  – This means speed up the video 2 and a half time.  If you want to slow down play back by ½ try:  setpts=.5*PTS .

Combine video

./ffmpeg-git-20151004-64bit-static/ffmpeg -f concat -i combineTheseVideos.txt -c copy -y o.mov

This requires a text file.  I named the text files “combineTheseVideos.txt”.  Its structure looks like this.

file 'video1.mov'
file 'video2.mp4'
Posted in ffmpeg, Linux, video editing | Leave a comment