Arrow functions explained

June 19, 2019 Leave a comment

An arrow function expression is a syntactically compact alternative to a regular function expression, although without its own bindings to the this, arguments, super, or new.target keywords. Arrow function expressions are ill suited as methods, and they cannot be used as constructors.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions

Advertisements
Categories: javascript

OSError: [Errno 8] Exec format error

June 5, 2019 Leave a comment

Problem:
$ python3 run.py
* Serving Flask app "petsrus.petsrus" (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: on
* Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
* Restarting with stat
Traceback (most recent call last):
File "run.py", line 4, in
app.run(host="0.0.0.0", port=5000)
File "/home/vagrant/env/lib/python3.4/site-packages/flask/app.py", line 944, in run
run_simple(host, port, self, **options)
File "/home/vagrant/env/lib/python3.4/site-packages/werkzeug/serving.py", line 1007, in run_simple
run_with_reloader(inner, extra_files, reloader_interval, reloader_type)
File "/home/vagrant/env/lib/python3.4/site-packages/werkzeug/_reloader.py", line 332, in run_with_reloader
sys.exit(reloader.restart_with_reloader())
File "/home/vagrant/env/lib/python3.4/site-packages/werkzeug/_reloader.py", line 176, in restart_with_reloader
exit_code = subprocess.call(args, env=new_environ, close_fds=False)
File "/usr/lib/python3.4/subprocess.py", line 537, in call
with Popen(*popenargs, **kwargs) as p:
File "/usr/lib/python3.4/subprocess.py", line 859, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.4/subprocess.py", line 1457, in _execute_child
raise child_exception_type(errno_num, err_msg)
OSError: [Errno 8] Exec format error


Solution:

Added #!/usr/bin/env python to the file

#!/usr/bin/env python
from myapp import app

if __name__ == "__main__":
app.run(host="0.0.0.0", port=5000)


Source:

https://stackoverflow.com/questions/27606653/oserror-errno-8-exec-format-error

Categories: python

(Right to Left (The Mirror World

May 18, 2019 Leave a comment

It might seem that there is something wrong with the title up there, right? This is one of the challenges developers are likely to face when adding support for languages like Arabic on websites. In this blog post, we talk about the problems we faced and the solutions we came up with when supporting Arabic on the Spotify desktop client and web player.

Localization at Spotify is a big deal. Our mission is to “unlock the potential of human creativity—by giving a million creative artists the opportunity to live off their art and billions of fans the opportunity to enjoy and be inspired by it.” To achieve this mission, it’s important to be able to effectively communicate across the various languages that reflects the diversity of our users . Recently Spotify launched in the North Africa and West Asia regions. One of the languages spoken in these regions is Arabic. Unlike English, which is read from left to right, Arabic is read from right to left. This has implications for websites that want to support Arabic.

https://labs.spotify.com/2019/04/15/right-to-left-the-mirror-world/

Categories: Interesting

Ansible for deployment with docker — Schneide Blog

May 17, 2019 Leave a comment

We are using Jenkins not only for our continuous integration needs but also for running deployments at the push of a button. Back in the dark times™ this often meant using Apache Ant in combination with JSch to copy the projects artifacts to some target machine and execute some remote commands over ssh. After gathering […]

via Ansible for deployment with docker — Schneide Blog

Categories: Interesting

Remapping PgUp and PgDn Keys

May 8, 2019 Leave a comment

Problem:
PgDn/PgUp keys are too close to Left, Right arrow keys. They end up getting pressed unintentionally.

Solution:
Remap PgDn and PgUp to right and left arrow keys respectively.

Added this to the end of my .zshrc file.
# Disable pgdwn and pgup. Make the map to the arrow keys instead.
/usr/bin/xmodmap -e "keycode 112 = Left"
/usr/bin/xmodmap -e "keycode 117 = Right"

Source:
https://stackoverflow.com/questions/46316946/dell-xps-9395-disable-pgup-pgdwn-keys
https://askubuntu.com/questions/296155/how-can-i-remap-keyboard-keys

Categories: Interesting Tags: , , , ,

Chamois – The big botnet you didn’t hear about

May 7, 2019 Leave a comment

SINGAPORE—The Android security team announcing that it had eradicated the Chamois malware family from Google Play in March 2017, turned out to be Android’s “Mission Accomplished” moment. Version 3 of Chamois surfaced in January 2018, more sophisticated and virulent than previous versions, followed by version 4 a few months later.

Apps containing code associated with the Chamois malware family first surfaced on Google Play in August 2016, followed by version 2 in November 2016. At its peak, in March 2018, Chamois had infected 20.8 million devices, Android security engineer Maddie Stone said at the Kaspersky Security Analyst Summit. Infected devices were commandeered into a botnet, and received instructions from a remote command-and-control server.

The Android team has successfully chipped away at that number in the year since, and in March, there were fewer than 2 million infections.

Chamois was “the biggest botnet you’d never heard of,” Stone said.

Early versions of Chamois masqueraded as benign apps and tricked users into downloading the apps on to their devices, but Google Play’s scanning tools became more efficient and effective at recognizing and blocking Chamois. Later versions of Chamois switched tactics and tricked app developers and device manufacturers into incorporating the code directly into their apps, making it possible for these tainted apps to appear on Google Play, Stone said.

https://duo.com/decipher/chamois-the-big-botnet-you-didnt-hear-about

Categories: Interesting Tags: ,

brave browser – The following signatures were invalid: EXPKEYSIG 4FE13824E3FFC656 Brave Software

April 30, 2019 Leave a comment

Problem:
Got the following error when trying to update. Mainly an issue with brave browser.


$ sudo apt-get update
...
snip
...
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://brave-browser-apt-release.s3.brave.com bionic InRelease: The following signatures were invalid: EXPKEYSIG 4FE13824E3FFC656 Brave Software
W: Failed to fetch https://brave-browser-apt-release.s3.brave.com/dists/bionic/InRelease The following signatures were invalid: EXPKEYSIG 4FE13824E3FFC656 Brave Software
W: Some index files failed to download. They have been ignored, or old ones used instead

Solution:
$ gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv 4FE13824E3FFC656
$ gpg --export --armor 4FE13824E3FFC656 | sudo apt-key add -

Source:
https://askubuntu.com/questions/13065/how-do-i-fix-the-gpg-error-no-pubkey

Note:
Running on Ubuntu 18.0