Hyston blog
About • RSS

Biteshift

2020-01-11 11:06

I started to participate in Advent of code 2020. First couple tasks were easy, but after a while it keep getting harder and took more time, that I can manage on average december day. Today is 8 day and I done only 14 of them and want to share one bug, that I did found solving last one. I am pretty familiar with bitwise operators, espacially shift:

1 << 1; //result it 2 (bin: 10)
1 << 3; //result it 8 (bin: 1000)

However, in day 14 bitmask is 36 bit length. If you shift too much, it should be cut. Alright, I thought, lets use unsined 64-bit integers.
ulong a = 1 << 32;
Because currently I dont have a debugger1, and it worked flawlessly with smaller values, I havent noticed an error here. Documentation said

Because the shift operators are defined only for the int, uint, long, and ulong types, the result of an operation always contains at least 32 bits and I naturally assumed, that if I define left hand operand as 64bit, then result would be also 64. That was correct, but before it


  1. VS Code support for M1 macs is incomplete, as I'm afraid, until .net 6 😣


lsof

2020-01-09 09:01

sudo lsof /Volumes/2cent/ this shows disk activity. Today external disk drive refused to be ejected, Finder showed error that disk is still in use. lsof shows that many mds_store processes occupied it. kill and then turning off spotlight fixed this issue.


What I have learned about git today

2019-12-30 07:12

I knew about git hooks, but never actually used them. The first and obvious thing, that I could imagine — add branch name to git commit message. .git\hooks\ contain nice examples to start, but I was taken aback by amount of bash scripting, that is required. And, more importantly, it seems that it never works properly — neither Sourcetree or fork.git client were showing changes. However, after commit pre_commit_message hook was actually executed and branch name was inserted correctly. Examples like this should work flawlessly to my purpose. And I need to learn bash too 😶
Apparently, branching workflow, that we use at work, has a name. It's called gitflow (insert link), and it is used in many projects and even in our teams is proved as very convenient and easy solution. It is well described here and I can only describe one difference in how we use it: usually we do not merge release branch back to development (as well as hotfixes). All changes for current release accumulates in release branch, then we merge to master and only after deployment merge it back. 1 There is no harm to not merge release back into dev (as well as every hotfix), but it can be overlook and forgotten, but during deployment process it's just one step in list of instructions.


  1. The only exception — when release contain new migration, then it should be merged asap. Then I would be better to add migration to feature branch (even is feature is already merged to development and release) and, merge feature branch to development and release branch accordingly


asp.net core 3.1

2019-12-17 10:12

It's time for another blog update. I want to move some jobyjob projects to new .net LTS version, so it would be a good to practice update this fairy simply blog. Mostly everything went well by this post and official documentation.
But problem appeared with using libgit2sharp. By default, asp.net docker images using debian 10, with contain libgit2 version, that is incomparable with libgit2sharp nuget package, that I use to update posts. Solution was to switch base docker image tag to 3.1-bionic, with means to use ubuntu underneath.
Despite that solution is simple, it took some time to resolve it. Mostly because I need to sleep more to think quicker 🥱, but also any issue is a good reason to do refactoring and write tests. In my case, I added simple Result class instead of bool (or void) to define function execution result and log errors, if needed.
upd: I also revisited project structure, renamed some files, deleted others. I.e., I thought, that I dont need solution file - it looks like belong to "grownup" Visual Studio, while I use Code and mac anyway. But after all cleaning, OmniSharp stopped working - solution file was required. To put it back and add both projects:

dotnet new sln -n hysite dotnet sln hysite.sln add Hysite.Web/hysite.csproj Hysite.Tests/tests.csproj

iPhone XS: one year review (and how I use it)

2019-10-24 10:10

I'm have bought my iPhone xs roughly a year ago and it became the most important tool that i have. Not a toy, not a luxury item, may be slightly fidget cube, but mostly a tool.

iphone

I had iPhones before: iPhone 5s (died with bad battery), 6 (died after diving in bath), SE (sold on ebay), 6 plus (lasted two years, survived diving in the pool, battery/screen/camera replacement, sold on ebay) and SE again (returned back to amazon after two weeks). The most complex workflow with these phones were simultaneous listening to music or podcats, navigating with maps throw city, writing messages and taking notes/photos on the same time. But overall use cases were inconsistent. Basically I have played simple games, checked twitter and shared pics on instagram.

It's not like on iPhone XS it is vastly different, but now usage of this phone is much more coherent. At first I realised, what I will not do on this device:
Although screen diagonal is bigger than on 6+, it is narrower and is worse for games. I spent several hours in a couple (holedown and Alto odyssey), but many more I did purchased/installed and never actually opened. Active screen area is too narrow and gameplay usually is so basic, that it is not worth time (especially, after I got nintendo Switch). I have installed Civ VI and after playing free 30 turns my eyes were bleeding.
Same counts for movies. This is the best screen that I have at my disposal, it is OLED and HDR and both times when I opened proper content it looked gorgeous. But watching beautiful shots better on a big TV, even if best technology, that it provide is FullHD. Cartoons are looking ok, through (but I have watched once two seasons of Futurama on 2 inch mp3 player in 2007, so I may be not best person to judge here). But here comes another constraint: memory is only 64Gb. I simply cannot load bunch of stuff on it. The same rule applies for photos. it is possible to check pictures from last event and sort out best of them and filter others. But the rest of my photo library (which contain 40700photos) is in the cloud, not here.

So, no games and no movies, what's then?

Text

Every thought, every detail, everything, that I want to do or write or remind myself, goes into Drafts1. All notes I usually quickly capture in Drafts and continue whatever I'm currently doing. Later, when I have a free minute, I clean draft's inbox, mostly using actions, that I wrote for last year. And then text goes into several different places: Things. This is my task manager by default. It has nice and clean UI, tagging system and projects/areas separation. That is everything that I need from task management tool. Mostly all my tasks are going to two hobby dev projects or home area, but time to time I create new temporary project for whatever I need to do soon, that has more than one step: vacation, bike repair, tax documents etc. There are a lot of ways to organise tasks and Things is covered many of them. I have tried previously Omnifocus, but it is too complex for me.
Due If something is too simple to go to Things or all I need is just a reminder at certain time, then it goes to Due. There are three things, that I love for this app: first is popup view, that contain several predefined time options. For me it is 7:30, when I still at home and don't want to forget to do before I left, 12:45 and 17:30 - times at work before lunch and before I usually leave, when I can google something or buy near office and, finally, 21:30, right after my son goes to sleep. All duties, that I need to be reminded of, happen in these 4 times and it is great to have this predefined buttons. Main Due feature: until you explicitly confirm that your task is done, it going to remind about it every 5 minutes. Annoying, but it works. Lastly, it is configurable to run repeated tasks - I have reminders to turn stand desk on at 11 and 16 every week day, give vitamins to my kid every evening and so on. Such small things would clutter big task manager, but are perfect for Due.
Day One. Previously, I just created notes about my son every week and they gone directly to apple notes. But later I realised, that I want to write more and more thoughts. Some of them can land into twitter, some would be interesting to my wife, other can be wrote as a blog post (like this), but there is something else, that I do not want to share but still want to keep. If these thoughts are time specific and they sounds like journal entry, they go into Day One. I still do not know, will I ever read what I wrote there, but it is a restful feeling, that my thoughts and notes are not disappearing. I have a several journals there, but only two I update regular: remarks about my son and impressions for movies or games that I have watched or played.
If my draft is something, that is not time related but I still want to keep it, it goes into Bear. There I keep track of what I want to read or play or buy, I store short abstract thoughts, funny phrazes, that come into my or my wife's mind, ideas for apps, code snippets, command line tools use examples, food recipes and many many more things.
Last action in drafts that I occasionally use is Tweetbot. If thought, that I wrote is good enough to share with someone, then I just click and it open Tweetbot with my text as a draft. This is my twitter client by default since I found original client contain too much ads.
There are also several workflows that I use in drafts to manage weekly grocery list, but they are in constant flux, so not worth mentioning2.

drafts

This is also last phone that contain 3d touch and I use it constantly for cursor moving and text selection. Taping on space bar on XR or new pro iPhones may be acceptable as well, but I'm glad that I have this magic pressure layer under screen. And I'm little nervous, that it can be removed and replaced with long tap in next iOS versions.

Camera & photos

Since I bought this phone I use my big camera less and less. Picture quality is good, HDR effects and light smoothing is done automatically in nanoseconds instead of gluing several raws with different exposure later on MacBook, that can take up to a minute. And taking photo itself feels natural and lightning fast - one: phone out of pocket, two: squeeze button on right side of lock screen, three: take a picture that will land into instagram later. And/or to photo library, that had grown alarmingly fast in last year. I have a reminder once a month to review photos and remove duplicates using Gemini, but a there are too many good photos, that this camera produced and I feel sorry to delete. Time to time I look back on them and remind myself of some particular event, that happened in the past. For some years I dont have many photos - and I'm glad, that since I bought this phone I can see past clearlier and revive some joyful moments.
I dont have particular workflow for photos, mostly I took them with regular camera app, edit in Darkroom and post to Instagram. Sometimes I do hyperlapses and Hyperlapse is taking way steadier videos than standard app with configurable speed increase.
One tip for recording video: I usually shoot at 1080p60, this takes not so much space and 60fps feels very natural for me. But in bad light conditions it is worth to switching on 1080p30 for better picture quality. As far as I know, camera is still took 60 frames per second, but it use every second frame to increase exposure. Unfortunately, there is no quick way to switch between modes in camera app, but here is quick shortcut to camera settings.

Shortcuts

And, about Shortcuts... There are so many things written about them and so many stuff I don't know, that I feel anxiety even starting describing this topic. It is better to go to macstories and find endless ways to improve your life3. But, actually, creating shortcuts (and scripts in Scriptable) on small screen is not very convenient so I have to borrow my wife's iPad pro from time to time to tweak some scripts. And I actually do not use it all the time. My top 5 is:

Audio

airpods
Overcast I started listening podcasts in 2014, but until 2016 it was only two or three of them, that I hear and enjoy regular. Since then I open for myself relay.fm and some shows around that I consume everyday and overcast is best way to do that. One of the main features is smart speed, that remove all voids between words and save a lot of time. I have saved 166 hours (!!) only by this feature alone in last 4 years. Another feature is voice boost, which is useful when audio equipment is not very fancy and I need help to grasp words on foreign language - including car and airpods. Smart pause, when you resume it starts from beginning of previous phrase or word, neat design - this was first application, that I have subscribed to annually and it's totally worth it. Actually, it may be the cheapest one, it's only 9,99€ per year. I'm not subscribed to apple music, but I still use music app. Because of memory limitations, I cannot load all my music library to a phone (I can, but it will take 55 of /57Gb phone space). So I created in iTunes smart playlist, that is limited to 5Gb and filled with random, but familiar songs from my library. Most of my audio consumption belong to Spotify, with don't need to be described. Last audio app, that I discovered recently Dark noise. I use it almost every day at work, when I need to concentrate, stop listening to my colleagues chat and Spotify smart playlist not helping.

Conclusion

I hope to never ever decide to write such long review or article. I left uncovered many things and many apps that I use regularly, like Fiery feeds, 1password, linguee, Termius, Seven, and I'm not even mention banking clients, messengers and shopping apps.
I use my phone everyday and it seemed natural, that I can describe my usage in a few sentences, but task "finish iphone review" is hangin around Things today list for last two weeks. A phone for a modern person is not a toy nor calling device. It is a toolset and with OLED screen and leather case is also a nice thing, that I want to use every day4.


  1. Except messages, them I send directly

  2. For example, I hope to reuse travel workflows from Automators podcast for shopping list.

  3. Or spend hours and days playing with your phone.

  4. I should write one day about digital detoxication.


← Next Previous →