Optimizing shell scripts
Introduction Input Data Desired Output Approach Original Script ...
Introduction Input Data Desired Output Approach Original Script ...
I have been programming for about 40 years. Going through a lot of different languages and programming paradims. Lately most of my programming is done in: bash/shell script Python ...
Python development on Windows Distributing Python scripts as single EXE or Directory Installing netifaces on Windows Documentation generation ...
For years I have been using VNC for my remote desktop needs. This works usually well enough. The features that I like are: Basic set-up is easy Desktop sessions are persistent Can be used to view an actual X11.org desktop. ...
As part of my small project of movng my Z-Wave Hub to a Raspberry PI, I got an X728 kit. This has: UPS controller board RTC circuit ...
I always had issues remembering how to create releases. So in order to standardise things, I wrote this script: ghrelease So whenever I am ready to release I would then just issue ...
So I was looking for a way to version control database schemas, but I never found something that worked for me. I found all these options that never seem to match what I wanted: metabase dbv ...
This is the least you need to know to get to use a Python virtual environment. What is a Virtual Environment At its core, the main purpose of Python virtual environments is to create an isolated environment for Python projects. This means that each project can have its own dependencies, regardless of what ...
The other day I needed to copy a bunch of files between to servers in my home network. Because of the volume I wanted to copy the files without having to go through ssh's encryption overhead. So I figured I could use netcat for the data transport. To do that I wrote these short scripts. Remote scripts ...
Since now I have a Android TV I put away my HTPC and with that the capability to view DVDs or listen CDs directly. So I converted my entire CD and DVD library to media files and stored in my home NAS. Since we are talking hundreds of DVDs and CDs, I was using some tools. CD ripping For CD ripping, pretty much everything can be done with abcde. ...
Writing shell scripts leaves a lot of room to make mistakes, in ways that will cause your scripts to break on certain input, or (if some input is untrusted) open up security vulnerabilities. Here are some tips on how to make your shell scripts safer. Don't The simplest step is to avoid using shell at all. Many higher-level languages are both easier to write the code in in the first place, and avoid some of the issues that shell ...
So I finally moved my WordPress web sites to OpenShift. OpenShift is a cloud based Platform-as-a-Service offering from RedHat. And while there is a learning curve I would say that so far it works great. My implementation is a fully cloud based solution. Makes use of the following services: GitHub for code hosting ...
My latest weekend project. Making a normal digital camera WIFI enabled. With the Transcend Wi-Fi SD Card you can convert any digital camera into a Wi-Fi enable camera. What I did here is to set it up so that it would automatically upload photos whenever I turn the camera on while at home. The nice thing about this camera is that it runs a fully functional Linux environment within the card. The manufacturer was also nice enough to give you the opportunity to customize the card by running arbitrary shell scripts from the SD card itself. My code is in github. ...
So finally took the time to try out a Raspberry Pi. For this weekend project wanted to do something relatively simple. Essentially, I wanted to recreate/enhance the functionality of a TL-WR702N. The TL-WR702N Nano Router is a neat device but being closed, can not be customized to what I wanted. It can be used in the following modes: ...
Testing, code coverage, style enforcement are all check-in and merge requirements that can be automated and driven from Git. If you're among the rising number of Git users out there, you're in luck: You can automate pieces of your development workflow with Git hooks. Hooks are a native Git mechanism for firing off custom scripts before or after certain operations such as commit, merge, applypatch, ...
Assist is my archlinux scripted installation script. https://github.com/alejandroliu/assist By default it gives you a menu driven archlinux installation with supposedly sensible defaults. It has command line hooks so that you can perform automated installs using bash scripts to customize it. ...
A bunch of stupid SSH tricks that can be useful somehow, somewhere... Forcing either IPv4 or IPv6 This is for the scenario that you know which specific protocol works to reach a particular host. Usually good to eliminate the delay for SSH to figure out to switch IP protocols. For IPv4: ssh -4 [email protected] ...
As usual with any IT system backups are important. This does not change when using a free shared hosting provider. Because it is free, one would argue it is even more important. For my wordpress web site I used something called cli-exporter. It let's you create "Wordpress" export files from the command line so it can be run from cron. This is important because backups have to be automated. In addition to that, I copy the backup files to an off-site location. I do this by copying files using WebDAV to a storage provider. I did this by writing a simple script and using the PHP library SabreDAV which makes writing DAV clients quite easy. I myself don't mind using other people's Open Source code to do something. I was actually surprised that I was not able to find something that meet my criteria. However, thanks to the power of open source I was able to find something that fit the bill exactly. To make things more interesting, because I wanted to keep backup files as compressed Zip archives, my backup scripts did not work in one of the web hosts that I was using. They did not have the zip extensions enabled. This is surprising considering is quite standard. Luckily I was able to find a pure PHP library pclzip. ...
Some useful tidbits to use when using the OpenWRT embedded web server (uHTTPD). Embedded Lua uHTTPd supports running Lua in-process, which can speed up Lua CGI scripts. It is unclear whether LuCI supports running in this embedded interpreter. LuCI seems to work fine (if not better) with the embedded ...
So one weekend went by and managed to finish up my 0ink.net web site. So now I have: wordpress For main content. tt-rss This is my answer to Google's shutdown of the Reader service. ...