ict.ken.be

Delivering solid user friendly software solutions since the dawn of time.

Add webcam stream to ipfire 

Categories: Network

Things to remember

  • Ipfire default web interface is on http port 81 or https port 444
  • Add .1 to version in /opt/pakfire/etc/pakfire.conf and do pakfire update --force so you can install addons from testing branch
  • Use pakfire to install motion
  • Motion by default streams on port 2500, but you can set this in /etc/motion.conf
  • Needed to add a video user and video group
  • The boot file /etc/init.d/motion needs some adjustments to allow starting motion at boot time
  • Set firewall rule correct to forward the port: From any to firewall red for tcp on port 2500 for webcam

Posts that helped me on the way

Adjustments to motion configuration

/etc/motion.conf

mkdir -p /var/motion/cam1
chown -R video: /var/motion/cam1
mkdir -p /var/run/motion/
chown video:video /var/run/motion/
chmod 755 /var/run/motion/
loadproc sudo -u video /usr/bin/motion

Move snapshots to dropbox

/etc/motion.conf

on_picture_save /etc/init.d/dropbox/up-snapshot.sh %f %Y%m%d %H%M%S

up-snapshot.sh

/etc/init.d/dropbox/du.sh upload $1 cam1/$2/$2-$3-snapshot.jpg && rm -f $1

Sync dropbox to main website on ipfire

sync.sh

rm -rf /srv/web/localhost/html/
/etc/init.d/dropbox/du.sh download html/ /src/web/localhost/
find /srv/web/localhost/html -type f -exec chmod 644 {} \;
find /srv/web/localhost/html -type d -exec chmod 755 {} \;

up-missing.sh

find /var/motion/cam1 -type f -exec sh -c './du.sh upload {} cam1/{}' \;

Linux commandline 

Categories: Linux

Bash

  • clear : empty console
  • ls -soah : show file details
  • cat filename : show content inline
  • less filename : show content in scrollable way
  • rm -I glob : remove but confirm once
  • mkdir -p : create new folder, ignore if exits
  • top : show processes
  • htop : show processes with colors
  • pstree -p : show which process contains what other process by id
  • kill processid : terminate process
  • df -h : show diskspace
  • reboot : restart the system
  • lsof -i : list open ipv[46] files by process
  • netstat -tulpn : display listening sockets
  • nmap -v 192.168.1.1 : find open ports on gateway
  • nc : networking tool - see https://en.wikipedia.org/wiki/Netcat
  • dmesg | grep -iC 3 "search item" : find in debug messages
  • curl -L ken.be : show website content inline and follow redirects
  • who : currently logged in users
  • whoami : user that run this command
  • passwd -Sa : show status of all accounts
  • groupadd groupname : create new group
  • useradd -m -g groupname username : create home, add user and assign group 
  • find / -group groupname : find files owned by group
  • find / -user username : find files owned by user
  • stat -c %U /var/motion/cam1 : show who ownes the folder
  • sudo -u username somecommand : elevate permissions for command
  • chown video:video /var/whatever : change file ownership
  • chmod 755 /var/whatever : change file permissions
  • chmod +x script.sh : add execute permissions to script file

Disable Angular Debugging 

Categories: Angularjs
myApp.config(['$compileProvider', function ($compileProvider) {
            $compileProvider.debugInfoEnabled(false);
}]);

It keeps amazing me why people do not disable debugging when deploying to production.

Clever money scam 

Categories: Security

Story of a security breach that recently happened on large scale in the wild.

  • Company sends invoices by email.
  • Some hackers intercept the smtp and replace bankaccount numbers from invoices that are at least 15K.
  • Customers pay on this wrong bank account.
  • Company decides that because the invoices are from their 'bigger' clients to wait before complaining that they didn't receive the payment.
  • They finally do and notice that their customers have been paying to the wrong accounts.
  • Digital thiefs gone with the wind.

Lessons learned

  • Always check if you are paying to the correct bank account.
  • We should always encrypt smtp.
  • Social engineering tricks are to easy to implement. (they did use a copy of the online accounting tool to make it look more real)

Conclusion

It's 2016 and a lot of the online payments are still using the smtp protocol. How are we going to teach people that this is not a good thing. And what will companies do to spy on those mails once we all start using encrypted mails.

Https comes to mind... we finally got people looking at the green icon and now we are inserting 'invisible' proxies. I guess... I will be member of the last generation that knew privacy and digital security.

 

 

Support multiple languages on your site 

Categories: HTML

From: https://support.google.com/webmasters/answer/182192?hl=en&ref_topic=2370587

Content

  • don't mix languages in the content
  • block robots from crawling auto translated pages -> can harm site perception
  • keep content for each language on a separated url
  • do not use cookies to change content language
  • cross link each version of a page (so user can switch with one click)
  • avoid automatic redirect on perceived language
  • always use UTF-8 in the url and as much as possible
  • google will use TLD as strong signal for that country
  • if single country and general TLD then you should use country targetting of the google search console settings
  • server ip should be close to the users
  • indicators of address, google my business, phone,... will be used to localize your content
  • google does not use geo.position, distribution and/or html tags
  • use canonical when same translation in more then one place
  • use hreflang and regional urls

Domain Examples

  • example.ie (server location irrelevant)
  • de.example.com (country or language?)
  • example.com/de/ (can use console targetting)
  • site.com?loc=de (not recommended)

Culture

From: https://support.google.com/webmasters/answer/189077

  • tailored to language, market and culture.
  • have support available for the language.
  • english dollar vs english pound
  • when using culture specific hreflang, also use an only language one
  • x-default for mixed and language selectors
  • specify only on the cannonical url
  • all alternatives should be included, also the page itself
  • prefered to keep alternatives in a similar directory structure as main language
  • be consistend with your url structure
  • display a banner to suggest an alternative page in user language instead of redirecting
  • avoid putting language or country in a url parameter
  • use UTF-8 for urls
  • !! it's not clear if one should or should not translate the urls !!
  • page speed within the country is a strong signal
  • add ability to swith language
  • ensure tourist experience, do not lock users into their current ip location

Html Elements

<link rel="alternate" hreflang="es" href="http://es.example.com/page.html" />

or with html header

Link: <a href="http://es.example.com/" target="_blank">http://es.example.com/; rel="alternate"; hreflang=es"

or in sitemap

<xhtml: link rel="alternate" hreflang="en-gb" ...

Static generators

Jekyll example: https://github.com/sylvaindurand/multilingual-jekyll

Page 3 of 40 << < 1 2 3 4 5 6 7 8 9 10 20 > >>