Click Technology

Linux, Windows, Mac it's all good

Good to (not) know

June27

Check out this tweet form Mr. Edward Snowden.  Interesting indeed.  PGP still looks intact in its raw form.  This is good news.  Assuming the end point device has not been compromised of course and the password and private key snarfed.  That said, that is something really only a state player or well financed operative will have a shot at.  For the regular folk using PGP means always having your thoughts and ideas protected.  If somebody gets access to your mail server, as per Hillary Clinton, at least the attacker will have squigabytes worth of nothing and nobody finds out about your involvement with Saudi, mis-handling classified documents, Libya and the Clinton Foundation.

Your email was intercepted.  Two words.  “Shit” and “Jack”.

posted under General, Linux Tips | Comments Off on Good to (not) know

Useful backup advice..

June5

It’s always a good time to remind yourself of the advantages of having a backup of your files.  Have a read of the Tao of Backup, before it’s too late!

posted under Linux Tips | No Comments »

Stack overflow gem

May29

I was looking for some info on the right way to use a regex to parse a small piece of html which had me stumped.

I found this gem on stack overflow with 4426 positive replies.  This guy gets it.

posted under Linux Tips | No Comments »

Tips and Tricks

May17

I’ve been working with PIC micro-controllers lately and found this great document from Microchip with a collection of tips and tricks that people have used with micro-controllers. That’s the first time I’ve seen a multinational publish a ‘notes-from-the-field’ document about their technologies and how to do clever stuff with them. Check the format out too; each tip is half a paragraph and gets everything summarised in a nutshell. Great document.

posted under Linux Tips | No Comments »

How to set up LTSpice IV models

May17

This is just a brief reminder on how to add third party models to LTSpice IV, the venerable electronics modelling software. My copy is running on wine, under Linux. Installs and runs first time, no fuss. In this example, I’m going to add in a new triac I’d like to use.

Step 1 : On your machine you have two folders for models. The mathematical models themselves are at

/home/username/.wine/drive_c/Program Files (x86)/LTC/LTspiceIV/lib/sub/

while the symbols for those models are at..

/home/username/.wine/drive_c/Program Files (x86)/LTC/LTspiceIV/lib/sym/

Create a folder in each of these two folders called

myspice

and, for the sake of better long term organisation, create a new sub-folder called triacs, thus

mkdir -p "$HOME/.wine/drive_c/Program Files (x86)/LTC/LTspiceIV/lib/sym/myspice/triacs"
mkdir -p "$HOME/.wine/drive_c/Program Files (x86)/LTC/LTspiceIV/lib/sub/myspice/triacs"

Your folder tree should look like this. For clarity, some subdirectories have been removed.

.
.
|-- drafts
|-- examples
|   |-- Educational
|   |   |-- contrib
|   |   |-- FRA
|   |   `-- PAsystem
|   `-- jigs
`-- lib
    |-- cmp
    |-- sub
    |   `-- myspice
    |       |-- transformers
    |       `-- triacs
    `-- sym
        |-- AutoGenerated
        |-- Comparators
        |-- Digital
        |-- FilterProducts
        |-- Misc
        |-- myspice
        |   |-- transformers
        |   `-- triacs
        |-- Opamps
        |-- Optos
        |-- PowerProducts
        |-- References
        |-- SpecialFunctions
        `-- Trafos

Step 2 : Download the triac model from here into the /lib/sub/myspice/triacs/ folder.

In this particular case, the file from the vendor appears as a .htm file, but in reality is just a text file, so rename it as

Thyristor_TRIAC_Qxx15xx_Qxx16x_Hx_A_SPICE_Model.lib

99 times in 100, this is just a plain text file and downloadable as such.

Step 3 : Start LTSpice IV.

Step 4 : Choose File, Open and navigate to /lib/sub/myspice/triacs/ and open Thyristor_TRIAC_Qxx15xx_Qxx16x_Hx_A_SPICE_Model.lib

Step 5 : Press CTRL + F to open the ‘find’ dialog box and enter the model you want to create. In this case, I would like to use the Q6016LH3, so I enter that into the search box and click OK. The term is found and the term is highlighted.

Step 6 : Now right-click the highlighted text and click ‘Create Symbol’.

The message “Do you wish to automatically create a symbol that will netlist against the subcircuit Q6016LH3 and her 2 ports?” appears. Click Yes. The visual of the model is drawn.

Step 7 : Make any changes you need to to complete the model. I’m going to make some changes to the visual so that the Gate, MT1 and MT2 are shown clearly instead of the generic terms ‘1’, ‘2’ and ‘3’. It can be seen in the model file what the terminal numbers relate to, so 1 = MT2, 2 = G and 3 = MT1. Right click each blue square terminal in turn and modify as required.

Step 8 : Choose File, Save As, navigate to your /lib/sym/myspice/triacs/ folder and save your symbol file. Incidentally, the file automatically appears in a newly created folder called AutoGenerated. Close the model file and the symbol file. Finished.

To use the new symbol and model, simply open your normal simulation circuit and click the ‘component’ button. Navigate to your new model in the myspice\triacs folder and click to select the model. The new device appears.

Finished.

posted under Linux Tips | Comments Off on How to set up LTSpice IV models

YouTube Downloading

May15

I’ve been using

youtube-dl

for ages now and use it to download videos, podcasts and playlists I want to listen to offline. To install it on Linux, just use

sudo apt-get install youtube-dl

Once in, all that’s needed is the URL you want to download, and, once you have it, you just use it like this..

youtube-dl https://www.youtube.com/watch?v=USg3NR76XpQ

Simple.

But the video in this case is a three hour podcast, so that ends up being around 3GB. A lot. Can we get a smaller version?

Yes. Use the -F switch to list all the available audio/video and audio only formats..

youtube-dl -F https://www.youtube.com/watch?v=USg3NR76XpQ

You get this..

user@host $ youtube-dl -F https://youtu.be/USg3NR76XpQ
[youtube] USg3NR76XpQ: Downloading webpage
[youtube] USg3NR76XpQ: Downloading video info webpage
[youtube] USg3NR76XpQ: Extracting video information
[youtube] USg3NR76XpQ: Downloading MPD manifest
[info] Available formats for USg3NR76XpQ:
format code  extension  resolution note
249          webm       audio only DASH audio   55k , opus @ 50k, 64.26MiB
139          m4a        audio only DASH audio   58k , m4a_dash container, mp4a.40.5@ 48k (22050Hz), 60.43MiB
250          webm       audio only DASH audio   73k , opus @ 70k, 79.10MiB
171          webm       audio only DASH audio  110k , vorbis@128k, 125.32MiB
140          m4a        audio only DASH audio  137k , m4a_dash container, mp4a.40.2@128k (44100Hz), 161.38MiB
251          webm       audio only DASH audio  139k , opus @160k, 147.56MiB
160          mp4        256x144    DASH video  148k , avc1.4d400c, 30fps, video only, 42.91MiB
278          webm       256x144    144p  154k , webm container, vp9, 30fps, video only, 119.24MiB
242          webm       426x240    240p  278k , vp9, 30fps, video only, 154.07MiB
133          mp4        426x240    DASH video  282k , avc1.4d4015, 30fps, video only, 136.58MiB
243          webm       640x360    360p  469k , vp9, 30fps, video only, 346.58MiB
134          mp4        640x360    DASH video  610k , avc1.4d401e, 30fps, video only, 204.77MiB
244          webm       854x480    480p  856k , vp9, 30fps, video only, 673.62MiB
135          mp4        854x480    DASH video 1024k , avc1.4d401f, 30fps, video only, 521.78MiB
247          webm       1280x720   720p 1729k , vp9, 30fps, video only, 1.79GiB
136          mp4        1280x720   DASH video 1875k , avc1.4d401f, 30fps, video only, 1.20GiB
248          webm       1920x1080  1080p 3188k , vp9, 30fps, video only, 3.58GiB
137          mp4        1920x1080  DASH video 3569k , avc1.640028, 30fps, video only, 3.06GiB
17           3gp        176x144    small , mp4v.20.3, mp4a.40.2@ 24k
36           3gp        320x180    small , mp4v.20.3, mp4a.40.2
43           webm       640x360    medium , vp8.0, vorbis@128k
18           mp4        640x360    medium , avc1.42001E, mp4a.40.2@ 96k
22           mp4        1280x720   hd720 , avc1.64001F, mp4a.40.2@192k (best)

This extensive list of options allows you to pick a preferred format. I’m going to go for option 139

139          m4a        audio only DASH audio   58k , m4a_dash container, mp4a.40.5@ 48k (22050Hz), 60.43MiB

which is a more manageable 60MB. Let’s download that.

youtube-dl -f 139 https://www.youtube.com/watch?v=USg3NR76XpQ

Nice. Job done.

posted under Linux Tips | No Comments »
« Older Entries