The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,860 other subscribers

Archive for the ‘bash’ Category

How to verify app signatures in OS X | MacIssues

Posted by jpluimers on 2015/12/18

Interesting:

For codesign verification:

find /Applications -d 1 -name "*.app" -exec codesign --verify --verbose {} \;

For system policy assessment:

find /Applications -d 1 -name "*.app" -exec spctl --assess --verbose {} \;

–jeroen

Source: How to verify app signatures in OS X | MacIssues

Posted in Apple, bash, Development, Mac, Mac OS X / OS X / MacOS, Mac OS X 10.6 Snow Leopard, MacBook, MacBook Retina, MacBook-Air, MacBook-Pro, MacMini, OS X 10.10 Yosemite, OS X 10.8 Mountain Lion, OS X 10.9 Mavericks, Power User, Scripting, Software Development | Leave a Comment »

BashPitfalls: common errors that Bash programmers make – Greg’s Wiki

Posted by jpluimers on 2015/12/03

I wish I had seen this years ago, as I’ve always had a hate-hate relationship with many shells on many OS-es.

I’ve included the ToC; read the rest of BashPitfalls: common errors that Bash programmers make – Greg’s Wiki back-to-back. It’s worth it, really.

Bash Pitfalls

This page shows common errors that Bash programmers make. These examples are all flawed in some way.

You will save yourself from many of these pitfalls if you simply always use quotes and never use WordSplitting for any reason! Word splitting is a broken legacy misfeature inherited from the Bourne shell that’s stuck on by default if you don’t quote expansions. The vast majority of pitfalls are in some way related to unquoted expansions, and the ensuing word splitting and globbing that result.

Posted in bash, Development, Scripting, Software Development | Leave a Comment »

osx – Toggle AppleShowAllFiles with a simple bash script? – Stack Overflow

Posted by jpluimers on 2015/10/15

LOL:

The if syntax of your script was a bit…well, iffy.

Indeed it is:

#!/bin/bash
#toggle AppleShowAllFiles

current_value=$(defaults read com.apple.finder AppleShowAllFiles)
if [ $current_value = "TRUE" ]
then
  defaults write com.apple.finder AppleShowAllFiles FALSE
else
  defaults write com.apple.finder AppleShowAllFiles TRUE
fi

killall Finder

Even the alternative if statement is:

if [[ $(defaults read com.apple.finder AppleShowAllFiles) == TRUE ]]

–jeroen

via osx – Toggle AppleShowAllFiles with a simple bash script? – Stack Overflow.

Posted in Apple, bash, Development, Mac, Mac OS X / OS X / MacOS, Mac OS X 10.4 Tiger, Mac OS X 10.5 Leopard, Mac OS X 10.6 Snow Leopard, Mac OS X 10.7 Lion, OS X 10.10 Yosemite, OS X 10.8 Mountain Lion, OS X 10.9 Mavericks, Power User, Scripting, Software Development | Leave a Comment »

Dynamic DNS through NO-IP: keeping your hosts current, and your NO-IP account happy.

Posted by jpluimers on 2015/05/19

Now that DynamicDNS moved itself to a fully payed service, named it DynDns Pro, then renamed it Remote Access and limiting it to 30 hosts for USD 25 a year, I looked for alternatives, and noticed NO-IP.

I like it for a few reasons:

OK, last year, there was this Microsoft Legal Action and Controversy, but I think that is a once time thing (some people even argue that Microsoft wasn’t thinking), so I created the last script below in PowerShell.

A few open-source scripts to keep your NO-IP account happy (that also work on most other DDNS providers like Duck DNS):

Read the rest of this entry »

Posted in *nix, *nix-tools, bash, CommandLine, Development, Perl, PHP, Power User, PowerShell, Scripting, Software Development | 1 Comment »

Mac OS X: Replicating md5sum Output Format (via: Raam Dev)

Posted by jpluimers on 2015/02/18

Mac OS X has md5, but no md5sum.

I agree with Mac OS X: Replicating md5sum Output Format that the second way of emulating md5 is better than the first one.

So here it is:


#!/bin/bash
/sbin/md5 -r "$@"

view raw

md5sum.bash

hosted with ❤ by GitHub

–jeroen

via: Mac OS X: Replicating md5sum Output Format – Raam Dev

Posted in Apple, bash, Development, Hashing, Mac, Mac OS X / OS X / MacOS, Mac OS X 10.4 Tiger, Mac OS X 10.5 Leopard, Mac OS X 10.6 Snow Leopard, Mac OS X 10.7 Lion, MacBook, MacBook Retina, MacBook-Air, MacBook-Pro, md5, OS X 10.8 Mountain Lion, Power User, Scripting, Security, Software Development | Leave a Comment »

RosettaCode: cool way to improve your coding skills

Posted by jpluimers on 2015/01/22

Wow: I feel like having lived under a stone for 8 years, as RosettaCode has been alive since it was founded in 2007 by Mike Mol.

The idea is that you solve a task and learn from that, or learn by seeing how others have solved tasks or draft tasks.

So in a sense it is similar to the Rosetta stone: it has different languages phrasing the same tasks.

There are already a whole bunch of languages on RosettaCode (of which a few are in the categories below), and you can even suggest or add your own languages.

When you want to solve tasks, be sure to look at the list unimplemented tasks by language that leads to automatic reports by language (for instance two of the languages I use most often: C# and Delphi).

I’m sure there are lots of programming chrestomathy sites, even beyond the ones, and it feels very similar to programming kata sites.

–jeroen

Posted in .NET, APL, Awk, bash, Batch-Files, C, C#, C++, COBOL, CommandLine, Delphi, Development, Fortran, FreePascal, Java, JavaScript/ECMAScript, Lazarus, Object Pascal, Office VBA, Pascal, Perl, PHP, PowerShell, PowerShell, Prism, Scripting, sed script, Sh Shell, Software Development, Turbo Prolog, VB.NET, VBS, VBScript, Visual Studio and tools, Web Development | Leave a Comment »

bash vulnerability; patch your *n*x boxes A.S.A.P. (via: CERT/NIST reveal level 10 bash alert today, 24 September 2014)

Posted by jpluimers on 2014/09/25

Unpatched bash allows for remote code execution.

Patch as soon as you can and be aware that the current patches might not be complete.

Many vendors (including Debian, Red Hat, SuSE, Ubuntu) already have patches available: CERT/NIST reveal level 10 bash alert today, 24 September 2014.

This is a long article which explains the why/how/… and has an easy check to see if you are vulnerable: What is the CVE-2014-6271 bash vulnerability and, how do I fix it.

It looks like the current patches aren’t complete yet, but do plug big parts of the hole.

Watch bash CVEs in Ubuntu and CVE-2014-7169 in Ubuntu (and maybe for other nx varieties as well).

Update:

Quote from the article:

Read the rest of this entry »

Posted in *nix, *nix-tools, bash, Development, Power User, Scripting, Software Development | Leave a Comment »

Linux/bash: using mutt to send a file as an email attachment (via: Stack Overflow)

Posted by jpluimers on 2014/08/21

Just in case I need this again:

None of the mutt ones worked for me. It was thinking the email address was part of the attachemnt. Had to do:

echo “This is the message body” | mutt -a “/path/to/file.to.attach” -s “subject of message” — recipient@domain.com

Thanks Alexander Bird for noticing the double-dash, rynop for the modified answer and Chris N for the original answer.

From mutt(1): Mutt Mail User Agent – Linux man page: Read the rest of this entry »

Posted in *nix, bash, Development, Linux, Power User, Scripting, Software Development, SuSE Linux | Leave a Comment »

Some more notes on ASUS RT-N66U, firmwares, temperatures and versions

Posted by jpluimers on 2014/08/20

In the the irregular series of ASUS RT-N66U and TomatoUSB posts:

Execute this script from the Tomato USB interface, or a ssh/telnet shell:

cat /dev/mtd0ro | grep bl_version
nvram get os_version
nvram get clkfreq
wl -i eth1 phy_tempsense | awk '{print $1/2+20;}'
wl -i eth2 phy_tempsense | awk '{print $1/2+20;}'
  • Line 1 gets the CFE bootloader version
    (1.0.2 and lower boot with 32K of NVRAM, 1.0.3 and up with 64K of RAM; some Firmwares work around the 32k limitation)
  • Line 2 gets the Firmware model and version
  • Line 3 gets the CPU speed
  • Line 4 and 5 get the temperature for eth1 (2.4 Ghz) and eth2 (5 Ghz) in Celsius
    It is based on the RMerlinDev (firmware developer) information on temperatures: These are for each radio. Take the returned value, divide by 2, then add 20. Results are in Celcius.
    Next to that knowledge, it uses a few tricks on awk calculation, and first parameter in awk (the second parameter would be the hex value of the temperature code in parenthesis) which is easier than shell calculations.

Based on those, I found a few very useful scripts:

–jeroen

Posted in ASUS RT-N66U, Awk, bash, Development, Internet, Network-and-equipment, Power User, Scripting, Software Development, TomatoUSB | Leave a Comment »

Hiding email behind a 30x redirect.

Posted by jpluimers on 2014/06/24

Last week, I thanked Jaykul for helping me out on PowerShell.

But he taught me another thing that was new for me: on his site, he has hidden his email address behind a 302-redirect.

I didn’t even realize that was possible until I saw his site start my mail program without initially showing a mailto in the url. A quick check showed me he was using a 302-redirect: Read the rest of this entry »

Posted in *nix, Apache2, bash, Development, Linux, Power User, Scripting, Software Development, SuSE Linux, wget | Leave a Comment »