Click Technology

Linux, Windows, Mac it's all good

Open source file sharing..

January25

Happy New Year to all. Here’s to a great New Year! Really! 🙂

This is pretty awesome. I just found a piece of open source file sharing web software called Bozon for when you want to host your own web files, but just make it simple and not have any admin overhead. Once running, all you need to do is upload the files you want to share to your server and then email the link. It’s that simple. Setup takes about five minutes, end to end.

To install Bozon, on your Linux box, assuming you have apache or nginx running and in operation, just do this..

cd /var/www
sudo su
git clone https://github.com/broncowdd/BoZoN.git bozon

It pulls the git repository down. If you need to install git, it’s just

sudo apt install git

.

[sudo] password for username: 
Cloning into 'bozon'...
remote: Counting objects: 1478, done.
remote: Total 1478 (delta 0), reused 0 (delta 0), pack-reused 1478
Receiving objects: 100% (1478/1478), 1.95 MiB | 567 KiB/s, done.
Resolving deltas: 100% (783/783), done.

You now have

/var/www/bozon/

with all the relevant files therein. Set the privs.

sudo chown www-data -R bozon/

Now link to this directory from your server. Let’s say you have a site structure like this and you want to put bozon in site03.

|-- var
\-- www
    |-- bozon
    |-- site01
    |-- site02
    |-- site03
        |-- code
        |-- js
        \-- html
    \-- site04

Let’s add a link.

cd /var/www/site03
sudo ln -s /var/www/bozon/

Right, that should be everything. Install is complete. Surf to https://www.yoursite.com/bozon and create a first time user and just begin using it.

Upload the files you want and when they upload, click the link share icon to reveal the URL to the file. Mail your friends the link. Simple.

Naturally, you are strongly advised to use https for reasons that should be fairly obvious.

First post best post.

posted under Linux Tips | No Comments »

Programming Best Practices Tidbits

October21

While writing some Python code to calculate PAYE and publish it to GutHub, I found this absolutely awesome set of advisory snippets that have really enlightened me on the crux of development work.

https://github.com/thomasdavis/best-practices

Enjoy.

posted under Linux Tips | Comments Off on Programming Best Practices Tidbits

Which version of Linux am I running?

June15

How many times have I tried to find out _exactly_ which version of Linux I’m running when installing something?  I either get the kernel version (no good for adding debs etc) when I want to find out what the Debian underlying codename is and so on. Here then is the solution. All of it.

uname -a && cat /etc/*release
posted under Linux Tips | Comments Off on Which version of Linux am I running?

Happy Ed Balls day

April28


Happy Ed Balls day

posted under General | Comments Off on Happy Ed Balls day

UK postcode regular expressions

March17

I found these two regexps expressions for UK postcodes today. The first is check if the number and letter sequence is correct. I’ve modified it slightly to look for one or two spaces between the groups of letters and numbers. Worked pretty well under PCRE. Noice. The second regex is to validate the postcode in its entirety. It worked for all the postcodes I had, but this is a constantly changing situation.

Just the basics – format is valid?

Here it is and requires the g(lobal) switch.

([A-Z]{1,2}[0-9][0-9A-Z]?\s{1,2}?[0-9][A-Z]{2})

Sample data…

BA2 3BH
UB11 1FW
CR0 4ZS
This is a B73 6AZ postcode
SW1E 5JD
LS1 2JZ
W1W 8AG
WF16 0HL
London too, EC2A 2BB, nice.
RG21 4EA
BA15 1AJ
CB4 0FW
EC4M 9HH
AB10 1XL
EH2 2BY
EC4M 9HH
EH2 2BY

And a PHP snippet of the above..

    $re = "/([A-Z]{1,2}[0-9][0-9A-Z]?\\s{1,2}?[0-9][A-Z]{2})/"; 
    $str = "BA2 3BH\nUB11 1FW\nCR0 4ZS\nThis is a B73 6AZ postcode\nSW1E 5JD\nLS1 2JZ\nW1W 8AG\nWF16 0HL\nLondon too, EC2A 2BB, nice.\nRG21 4EA\nBA15 1AJ\nCB4 0FW\nEC4M 9HH\nAB10 1XL\nEH2 2BY\nEC4M 9HH\nEH2 2BY"; 
     
    preg_match_all($re, $str, $matches);

Full Monty – Postcode itself is valid?

This regexp should be able to validate most postcodes. Worked well on all the data I had.

^GIR[ ]?0AA|((AB|AL|B|BA|BB|BD|BH|BL|BN|BR|BS|BT|BX|CA|CB|CF|CH|CM|CO|CR|CT|CV|CW|DA|DD|DE|DG|DH|DL|DN|DT|DY|E|EC|EH|EN|EX|FK|FY|G|GL|GY|GU|HA|HD|HG|HP|HR|HS|HU|HX|IG|IM|IP|IV|JE|KA|KT|KW|KY|L|LA|LD|LE|LL|LN|LS|LU|M|ME|MK|ML|N|NE|NG|NN|NP|NR|NW|OL|OX|PA|PE|PH|PL|PO|PR|RG|RH|RM|S|SA|SE|SG|SK|SL|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N\nHA1 1BQ\nEC2R 7AF\nEC2R 7AF\nEC2R 7AF\nEC2R 7AF\nRG1 1AX\nWC2R 1DJ\nW1J 0DW\n"
     
    re.findall(p, test_str)

By the way, some awesome regex testing websites are…

posted under Linux Tips | Comments Off on UK postcode regular expressions

IT summarized

March16

I sometimes feel like information technology is just exactly like this.

View post on imgur.com

There’s loads of great (open source) software out there but connecting it together to streamline it and thence make it really effective is the killer.

posted under General | Comments Off on IT summarized
« Older EntriesNewer Entries »

This is my website for short blog posts and interesting materials that are noteworthy or have some handy-tip value.