112 karma · joined Jun 18, 2018 (8y ago) · 32 submissions
1.
An easy way to concurrency and parallelism with Python stdlib(bitecode.dev ↗)
105 points · by olsgaarddk · 3y ago · 68 comments
comment 3y ago · link · parent
But yes, the public sector suffers from countless different systems that have accumulated over the years. It happens because everything has to go out to a public bid and throughout the times it has been considered anti competitive to built things in-house.
comment 3y ago · link · parent
I have a collection of python scripts you can use for text manipulation:
- regex:https://github.com/olsgaard/Japanese_nlp_scripts/blob/master...
- translitteration tables: https://github.com/olsgaard/Japanese_nlp_scripts/blob/master...
comment 4y ago · link · parent
This need for bottled water is relatively new. Some of us on HN lived at a time when the concept was absurd, others have grown up with bottled water.
Meeting rooms used to serve a carafe of water and glasses. Now everybody gets a bottle. So obviously they are competing.
comment 4y ago · link · parent
When you ask yourself in the super market "Who in their right mind wants a snickers and mint flavored orea?" this is that segment.
So, in my case, the beer industry was (is? This was a decade ago) losing sales to ready-mades (Barcadi Breezer, cans of rum and coke, etc.) and a way to hold on to consumers was simply to add new, limited run recipes.
All classes of drinks are trying to hold on to consumers who are being stolen by other classes of drinks, by offering up new colors and strange flavor combinations.
But at the same time I think you are right about companies training consumers to drink larger and larger portions sugared drinks. Like, 1.5 liter coca-cola isn't even the largest size drink in the cinema sometimes!
comment 4y ago · link · parent
And now his prints are of course ... out of print.
I'm not saying I need a numbered and signed limited print like The Tigers New Clothes [1] but it would be nice with maybe just a regularly, unsigned, unnumbered poster on my wall.
Are there any for sale?
[1] https://www.liberdistri.com/en/accueil/100--the-tiger-s-new-...
comment 4y ago · link · parent
Explanations for the beginner and intermediate regex and grep user:
`-o`: Only return the match, instead of the entire line
`-P`: use Perl compatible regex
`-m` max-count, Stop reading a file after NUM matching lines.
And now for the regex:
`name:`: find the exact match
`\s*"`: Zero or more spaces leading up to and including an double quote
`\K`: This was the kicker for me. "resets the starting point of the reported match. Any previously consumed characters are no longer included in the final match" - basically tells the regex engine that the characters _before_ `\K` needs to be there in order to form a match, but it should only return the characters _after_ `\K` as the match. This is super handy! Is there a "reverse \K"?
`[^"]+`: One or more characters that are not a double quote. This basically means "Find the line that has a key called "name" and return all the characters after the first double quote and until the last double quote"
comment 4y ago · link · parent
How does it work with common e-mail clients? How do people react when you show/tell them your email?
I have a domain that uses non-ascii characters, and while I can receive emails on that domain, hosted by Fastmail, Fastmail clients refuses to _send_ emails to that domain (I can, if I type the domain as Punycode).
comment 4y ago · link · parent
I realized that most of what I was reading on Reddit was fabricated outrage (since then they’ve added subs like “makes your blood boil” and “idiots in cars” - check them out if you feel like you are not outraged regularly enough)
I was the type of person who would sit on Reddit, be bored and type Reddit in the url bar.
So I decided to quit Reddit and used habitica for the task. It’s a gamification for to-do lists and forming habits. I added “visiting Reddit” as a minus 1, and every time I realized I was on Reddit I opened habitica and gave myself a minus 1.
Fictive internet points are quite powerful. I also started flossing this way (flossing at night, +1)
comment 4y ago · link · parent
With that being said it was very focused on BigQuery, and my impression is that it is that all their certs are now basically different variations of a kubernetes certification.
comment 4y ago · link · parent
I was told, that my account had been deactivate due to inactivity and that it was against my agreement with Tencent not to use WeChat regularly. After that I had to check a checkbox promising to log in regularly.
Luckily I haven't paid for WeChat, and I don't need it anymore to keep in contact with friends, so I was far enough removed from the situation to laugh at it.
comment 5y ago · link · parent
Spoilers ahead:
- 1st query to get the crime report. This contain plaintext clues.
- 2nd query to get witness interviews. Again, these contain plaintext clues that can't be used in a `join` statement or a `where` statement in SQL.
- 3rd query to get interview with suspect. This contain plaintext information needed for solving the second puzzle
- 4th query for finding the master mind.
Short of writing regexes that basically extracts the clues by looking for patterns that are verbatim the clues themselves, I don't see how it can be done any shorter than this.
You can see my solution here on my github: https://github.com/olsgaard/sql_murder_mystery_solution/blob...
comment 5y ago · link · parent
I wrote up a blogpost about my findings on how to generate monochrome plots. I haven’t really used matplotlibs since my thesis days, but it’s kinda funny to see what my thoughts back then were on the interface.
I found the OO interface a necessary evil and that you have to mix interfaces to get full control of your plots.
Maybe things have been ironed out in the past 5 years? Reading the comments here it seems like the sentiment is that the OO interface is considered the sane, true interface.
http://olsgaard.dk/monochrome-black-white-plots-in-matplotli...
comment 5y ago · link · parent
It’s quite common when giving my email over the phone that my full name has already been established so I really wished the “Ø”-version would work (I also own that domain) but most (many? Some? Too many) email clients refuse to send emails to servers that contains special characters.
I can receive emails at the ø-domain, but not send to it using Fastmail. They recommend I use puny codes but that’s way too difficult to communicate.
comment 5y ago · link · parent
Pure theme - My absolute favorite shell theme. Has almost all the bells and whistles of the powerlevel9k shown in the article, but looks, much cleaner and less in-your-face.
After downloading the theme, I've added this to my `.zshrc` file:
# PURE theme - see https://github.com/sindresorhus/pure
fpath+=$HOME/.zsh/pure
autoload -U promptinit; promptinit
prompt pure
Fuzzy find makes searching history much more powerful than what is listed in the article. I only use it together with ctr-r, but you can set it up for even more goodness. # Fuzzy find - see https://github.com/junegunn/fzf
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
Lastly I've added a syntax highlighter, which is really neat. # ZSH Syntax Highlighter - see https://github.com/zsh-users/zsh-syntax-highlighting
source $HOME/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
I don't use oh-my-zsh, but I think my terminal is as fully fledged as even the best oh-my-zsh can offer.comment 5y ago · link · parent
I use Sublime and I love scrolling. The second makes the system in TFTA not good for me, and given the first, I didn't mind my implementation being editor specific - but the principal is dead simple, as to not really matter.
I have a small custom function stored in Sublimes user package folder which, when called using the [cmd]+[shift]+p command palette will insert a small template in the top of the current file (my `daily.txt`).
This is just a headline with the date, and name of day of week and Two lines called start and end (with datetime filled in in start) let's me keep loose track of my hours.
I also have a sub-heading that says to-do, with two `[ ] ...` txt checkboxes already added, another headline called did and a line that separates it from the previous day.
"To-do" is for things I plan on doing, "did" is for ad-hoc things I ended up doing. This helps me keep track of how much work I actually did, which is nice for days where everything is meetings and firefighting and I don't close issues in the tracker or PRs in git.
I can use go-to symbol to jump to a date, or just search the document for key words. Like I said, I like scrolling, and enjoy being able to just scroll down to see the previous day.
The system is like I said dead simple, easy to operate, easy for anyone to implement and customize to their liking. I've used mine for a few months and it has been great!
comment 5y ago · link · parent
[1] https://www.amazon.com/Guide-Remembering-Japanese-Characters...
comment 5y ago · link · parent
For anyone who want to geek this out further, I highly recommend the the introduction in "Decoding Kanji: A Practical Approach to Learning Look-alike Characters" By Yaeko Sato Habein [1]. Despite being a workbook for intermediate students, the introduction really goes all-in on this stuff and treats the topic both very academically, but it also a treasure trove of kanji related "Fun facts", and the appendix has interesting compilations such as "Pairs of homonymous kanji compounds with one kanji in common".
[1] https://www.amazon.co.uk/Decoding-Kanji-Practical-Look-alike...
comment 6y ago · link · parent
I'm sure there are also good reasons :)
comment 6y ago · link · parent
In Python, instead of the example in the blog:
try:
do_something_complex(*args, **kwargs)
except MyException as ex:
logger.log(ex)
Use the almost undocumented `exc_info=True`, like this try:
do_something_complex(*args, **kwargs)
except MyException as ex:
logger.error(ex, exc_info=True)
This will log the entire exception.Even cooler, every un-caught exception calls `sys.excepthook()`. The function is supposed to be monkey patched by anyone who wants to do something with uncaught exceptions, so you can do the following if you want to log all uncaught exceptions:
def exception_logger_hook(exc_type, exc_value, exc_traceback):
logger.error("Uncaught exception", exc_info=(exc_type, exc_value, exc_traceback))
sys.__excepthook__(exc_type, exc_value, exc_traceback)
sys.excephook = exception_logger_hook
This will send all uncaught exceptions to the logger and then continue with raising the exception normally.comment 7y ago · link · parent
After that I build a search engine programme that would look up swear words that were phonetically similar to input terms, as I thought that my fellow students might get a laugh looking up their own names. In the end, neither Phonix, double metaphone nor Soundex really produced any funny results.
plugs:
- Blogpost: http://olsgaard.dk/phonixpy-phonetic-name-search-in-python.h...
- Github repo: https://github.com/olsgaard/phonetic_search
[1] Gadd, T. N. “‘Fisching Fore Werds’: Phonetic Retrieval of Written Text in Information Systems.” Program 22, no. 3 (1988): 222–37.
comment 7y ago · link · parent
I don’t have the source code on me, but I scraped it from a website that publishes subtitles. The scraping was easy, the cleaning not, and I believe this spreadsheet is generated from my first attempt at cleaning.
A lot of sources in Japanese nlp and linguistics have a bad habit of changing url often, so it bitrots easily. Sorry.