Archive for the ‘Scripting’ Category
Posted by jpluimers on 2016/10/26
TL;DR: OpenSuSE Tumbleweed – after installing from ISO, be sure to disable/remove the ISO repo.
A while ago I had a weird thing on my OpenSuSE Tumbleweed system while upgrading (yes, zypper dist-upgrade is the recommended way to update Tumbleweed): it would complain in this way zypper dup indicates python3-urllib3-1.16-1.1.noarch requires python(abi) = 3.5:
# zypper dup
Warning: You are about to do a distribution upgrade with all enabled repositories. Make sure these repositories are compatible before you continue. See 'man zypper' for more information about this command.
Loading repository data...
Reading installed packages...
Computing distribution upgrade...
Problem: python3-urllib3-1.16-1.1.noarch requires python(abi) = 3.5, but this requirement cannot be provided
Solution 1: Following actions will be done:
deinstallation of python3-urllib3-1.15.1-2.1.noarch
deinstallation of python3-wheel-0.29.0-2.1.noarch
deinstallation of speedtest-cli-0.3.2-4.3.noarch
deinstallation of python3-six-1.10.0-4.1.noarch
deinstallation of python3-pycparser-2.14-2.1.noarch
deinstallation of python3-pyasn1-0.1.9-2.1.noarch
deinstallation of python3-pyOpenSSL-16.0.0-3.1.noarch
deinstallation of python3-idna-2.1-1.1.noarch
deinstallation of python3-chardet-2.3.0-1.4.noarch
Solution 2: keep obsolete python-cupshelpers-1.5.7-7.2.noarch
Solution 3: break python3-urllib3-1.16-1.1.noarch by ignoring some of its dependencies
Choose from above solutions by number or cancel [1/2/3/c] (c):
What eventually – with help from the excellent help by DimStar on the #openSUSE-factory IRC channel – led to the solution was the part Solution 2: keep obsolete python-cupshelpers-1.5.7-7.2.noarch.
But first let’s look at the installed versions and repos:
Read the rest of this entry »
Posted in *nix, Development, Internet, Linux, openSuSE, Power User, Scripting, Software Development, SpeedTest, SuSE Linux, Tumbleweed | Leave a Comment »
Posted by jpluimers on 2016/10/25
I’m using Linux (centos) machine, I already connected to the other system using ssh. Now my question is how can I copy files from one system to another system?
Source: How to copy files from one machine to another using ssh – Unix & Linux Stack Exchange
Nice question, uh? In my opinion the best answer is “Use scp to avoid going through hoops with complex configurations to re-use your existing ssh connection” like this:
To copy a file from B to A while logged into B:
scp /path/to/file username@A:/path/to/destination
To copy a file from B to A while logged into A:
scp username@B:/path/to/file /path/to/destination
Source: DopeGhoti answering How to copy files from one machine to another using ssh – Unix & Linux Stack Exchange
Instead the question is marked duplicate of SSH easily copy file to local system – Unix & Linux Stack Exchange where (contrary to the ‘easily’ part of the question) go through hoops and loops with all kinds of fancy ssh settings and port forwards.
Recursive
For recursive, use the -r option, as per [WayBack] shell – How to copy a folder from remote to local using scp? – Stack Overflow:
scp -r user@your.server.example.com:/path/to/foo /home/user/Desktop/
From man scp (See online manual)
-r Recursively copy entire directories
Related:
Read the rest of this entry »
Posted in *nix, *nix-tools, bash, Communications Development, Development, Internet protocol suite, Power User, Scripting, Software Development, SSH, TCP | Leave a Comment »
Posted by jpluimers on 2016/10/20
The unix shell is hard, but boy, sometimes it can work like magic, for instance piping two testssl.sh commands into one gist:
retinambpro1tb:testssl.sh jeroenp$ ( ./testssl.sh --version ; ./testssl.sh --local ) | gist -d "testsll version and local ciphers for Mac OS X Darwin binarries supporting zlib"
https://gist.github.com/701496d7fbf929967aa1
The source of this magic was this AskUbuntu answer: How to merge and pipe results from two different commands to single command? – Ask Ubuntu
–jeroen
via: openssl.Darwin.x86_64 lacks zlib support · Issue #164 · drwetter/testssl.sh
Posted in *nix, *nix-tools, bash, bash, Development, Power User, Scripting, Software Development, Uncategorized | Leave a Comment »
Posted by jpluimers on 2016/10/18
I’m used to multiline comments in many languages, but since I don’t use bash very often, I only recently learned it can do that too.
So this is how to have comments span multiple lines in bash by using the : command which according to the bash man page does nothing:
: [arguments]
No effect; the command does nothing beyond expanding arguments and performing any specified redirections. A zero exit code is returned.
So the syntax is:
: '
your comments here
'
–jeroen
via: Shell Script Put Multiple Line Comment.
Posted in bash, Development, Scripting, Software Development | Leave a Comment »
Posted by jpluimers on 2016/10/11
Interesting, as I thought Mac OS X Yosemite and up – having Python installed – would also keep Python up-to-date, but they don’t.
Hence:
Installing Python on Mac OS X
The latest version of Mac OS X, Yosemite, comes with Python 2.7 out of the box.
…
The version of Python that ships with OS X is great for learning but it’s not good for development. The version shipped with OS X may be out of date from the official current Python release, which is considered the stable production version.
–jeroen
via:
Posted in Development, Python, Scripting, Software Development, xCode/Mac/iPad/iPhone/iOS/cocoa | Leave a Comment »
Posted by jpluimers on 2016/09/29
I needed to script a few things on my Fritz!Box. Here are the cURL links that I used to research some Fritz!Box scripting.
My first try was wget, but that didn’t do everything I need, so cURL came to the rescue.
In the end, I didn’t need cookies (a post request with an MD5 based handshake sufficed to get a session SID which is not stored in a Cookie), but that surely will come in useful another time.
Curl man page entries:
The script is and docs are here: jpluimers/bash-fritzclient.
–jeroen
Posted in *nix, bash, cURL, Development, Fritz!, Fritz!Box, Network-and-equipment, Power User, Scripting, Software Development, wget | Leave a Comment »
Posted by jpluimers on 2016/09/29
As it got live last week, this is required reading if you do web development:
–jeroen
Posted in Development, JavaScript/ECMAScript, Scripting, Software Development, TypeScript | Leave a Comment »
Posted by jpluimers on 2016/09/28
One of the things I missed in the Atom editor is a keyboard macro recording/playback.
I tried atom-keyboard-macros but it doesn’t work reliably.
Not sure where it fails as the failure patterns are inconclusive.
Anyone having a better experience?
–jeroen
Posted in atom editor, Development, Hardware, Keyboards and Keyboard Shortcuts, KVM keyboard/video/mouse, Power User, Scripting, Software Development, Text Editors | Leave a Comment »
Posted by jpluimers on 2016/09/20
In the 2009 past, sdelete used the -c parameter to zero wipe clean a hard drive and -z would clean it with a random pattern.
That has changed. Somewhere along the lines, -c and -z has swapped meaning which I didn’t notice.
This resulted in many of my virtual machines image backups were a lot larger than they needed to be.
The reason is that now:
-c does a clean free space with a random DoD conformant pattern (which does not compress well)
-z writes zeros in the free space
Incidently, -c is a lot slower than -z as well.
TL;DR: use this command
sdelete -z C:
Where C: is the drive to zero clean the free space.
–jeroen
Posted in Batch-Files, Development, Fusion, Hyper-V, Power User, Proxmox, Scripting, sdelete, Software Development, SysInternals, View, VirtualBox, Virtualization, VMware, VMware ESXi, VMware Workstation, Windows | Leave a Comment »
Posted by jpluimers on 2016/09/20
I wrote two tiny batch files that would dump the environment variables from the registry.
Various reasons:
- Environment variables can be stored in two contexts: System and User (SET will show them all at once and for instance combine PATH up to 1920 characters).
- Environment variables can be set to auto-expand or not, which you cannot see from a SET command (REG_EXPAND_SZ versus REG_SZ).
show-user-environment-variables.bat:
reg query "HKCU\Environment"
show-system-environment-variables.bat:
reg query "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment"
Filtered results:
Read the rest of this entry »
Posted in Batch-Files, Development, Power User, Scripting, Software Development, Windows, Windows 7, Windows 8, Windows 8.1, Windows 9, Windows NT, Windows Server 2000, Windows Server 2003, Windows Server 2003 R2, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2, Windows Vista, Windows XP | Leave a Comment »