Free cookie consent management tool by TermsFeed Policy Generator

/dev/blog/ID10T

Advertisement

Picture Howto: Adding group members in TextSecure

Misc Comments

I had the big task of explaining my mother how to add members to a TextSecure group. As she’s no IT native, she often forgets and tends to be slow on the uptake. That’s why I created a picture howto for it. It’s not polished in any way, but perhaps I can help someone who has met a similar challenge.

Python3: UnicodeDecodeError when using subprocess.Popen

Python Comments

While writing a Python script which handles an applications STDOUT on Windows, I encountered an error:

Traceback (most recent call last):
  File "C:/Users/m3adow/PycharmProjects/proj1/script.py", line 355, in <module>
    main()
  File "C:/Users/m3adow/PycharmProjects/proj1/script.py", line 347, in main
    openme(bin_args)
  File "C:/Users/m3adow/PycharmProjects/proj1/script.py", line 307, in spectate
    for line in iter(p.stdout.readline, ''):
  File "C:\tools\python\lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 1478: character maps to <undefined>

The lines in question looked like this:

def openme(bin_args):
  with subprocess.Popen(args=bin_args, stdout=subprocess.PIPE, stderr= subprocess.STDOUT, universal_newlines=True) as p:
        for line in iter(p.stdout.readline, ''):
          process_stdout(line)

Modifying And Repacking Android Apps

Android Comments

The problem

While installing a SuperHexagon APK which I bought from Humble Bundle a couple of years ago I encountered an error. The package installer simply stated “App not installed”, a logcat got me some more information:

D/Finsky  (22452): [1] 1.onResponse: Verification id=7 response=0
D/Finsky  (22452): [1] PackageVerificationReceiver.onReceive: Verification requested, id = 7
E/Vold    (  226): Error creating imagefile (Read-only file system)
E/Vold    (  226): ASEC image file creation failed (Read-only file system)
W/Vold    (  226): Returning OperationFailed - no handler for errno 30
E/PackageHelper(22426): Failed to create secure container smdl1097147630.tmp

Trying to install it via adb install didn’t help either:

adb install c:\home\downloads\SuperHexagon-release-v1.0.7-humblebundle.apk
5139 KB/s (27327032 bytes in 5.192s)
    pkg: /data/local/tmp/SuperHexagon-release-v1.0.7-humblebundle.apk
Failure [INSTALL_FAILED_CONTAINER_ERROR]

I did some research and finally found the problem. The HumbleBundle Android version of SuperHexagon hasn’t aged well, the APK is configured to install on SD card. This simply doesn’t work on my First Generation Moto G which doesn’t even have a SD card slot. So I did some more reasearch and found the solution. Of course this will most likely work for other applications with the same error too.

Use Perl As Sed Alternative

Linux Comments

Small tip for people often using sed for substitutions: In the process of porting my old wordpress blog posts to Jekyll I had to do a lot of substitutions. Specifically I had to substitute a lot of HTML Tags. Sadly, sed in most Linux distributions doesn’t support lazy regex quantifiers. When searching for an expression which is only known to begin with <code and end with > and a lot of possibilites between those delimiters, it’s really annoying to not have lazy quantifiers.

That’s why I’d recommend using perl for this. Perl can easily be used like sed:

# sed
sed -e 's/<code.*lang="bash".*>/&#123;% highlight bash %&#125;/g' test.html
# perl
perl -pe 's/<code.*?lang="bash".*?>/&#123;% highlight bash %&#125;/g' test.html
# Of course you can substitute inline:
perl -pi -e 's/<code.*?lang="bash".*?>/&#123;% highlight bash %&#125;/g' test.html

I really prefer the Regex handling of perl over the limited one of sed. That’s why I totally fell in love with this.

Technical fundament of /dev/blog/ID10T

Blog Comments

As the technical fundament of ID10T changed completely, it's a good idea to explicate its underlying infrastructure. I really like when other blogs websites or applications are thoroughly explaining their hosting technology, so I want to do it with my blog as well.

Blog software

I’m using Jekyll as my blog software of choice. Due to its nature of being a static page generator, all the end user sees, are completely generated pages without PHP or alike (some JScript though) which results in a very good pagespeed. The template I based my blog design on is Contrast from Niklas Buschmann.

Github pages

Like many other sites, I use Github pages as the hosting provider. It’s free, fast and provides a lot of flexibility due to it’s connection to git. Sadly, Github pages doesn’t provide a way to secure your connection. Https is only possible with the *.github.io domain, SSL with a custom one isn’t supported. To circumvent this, I prepend cloudflare with enabled and forced SSL encryption. This isn’t a true end-to-end encryption as the clients connection is only secured up until the cloudflare servers, the connection afterwards, from cloudflare to GH pages, remains unsecured. But at least there’s no possibility for an man-in-the-middle attack when using an open W-LAN.

Uberspace

When using only GH pages, there’s no way of previewing drafts. The normal way Github expects you to write up your posts is with a Jekyll instance running locally where you can serve the drafts all you want. But that’s not my use case. I’m one of those pesky “generation mobile” members. I want to be able to write posts everywhere, on every device, preview them on the go and publish them afterwards.

To realise that, I’m using an uberspace. Uberspace is a hybrid between shared hosting and a virtual server. An uberspace is able to run a plethora of software, Ruby with Jekyll is one of those. Thus, I planned on running a triumvirate of Dropbox, for the syncing from and to every device, Jekyll, for the preview of drafts and git to commit and push the changes to my Github repository belonging to my blog. I’m running a dropbox daemon on my uberspace which only syncs the folder containing the Jekyll source files. To start a build and deployment of the “local” (on uberspace) Jekyll installation or to commit and push the changes to github, I’ve written a small script which I called jekyll-file-remote. It’s basically an infinite loop checking a watch folder for control files.

Thereby I can write markdown drafts on every device I want, as those are synced via Dropbox. If I want to preview the drafts, I create a control file resulting in compiling them via the jekyll installed on my uberspace and previewing them into another location which is excluded for search engine crawlers. If I’m satisfied with my blog post, I create another control file for jekyll-file-remote, which automatically commits and pushes the changes to my m3adow.github.io repository.

Advertisement