[tumblr] extract data from a specific post

Problem
There is a specific tumblr post whose content you want to extract. Say it contains an image that you want to grab.

Solution
You can use the following API call (example):

post_url = "https://different-landscapes.tumblr.com/post/174158537319"

api_call = "https://api.tumblr.com/v2/blog/different-landscapes.tumblr.com/posts/photo?id=174158537319&api_key=YOUR_API_KEY"

The output is a JSON answer. For this you need an API key too.

Advertisements
Categories: api Tags: ,

Ubuntu 18.04

I upgraded some of my machines to Ubuntu 18.04. It looks good and the installation went flawlessly. Here is a nice post with some post-installations tips: Things To Do After Installing Ubuntu 18.04 Bionic Beaver Linux.

I did the followings:

  • install Gnome Tweaks
  • place titlebar buttons to the left
  • Make workspaces static. Number of workspaces: 4.
  • Install the the Gnome shell extension TaskBar. With this I can see the running apps in a bottom panel.
  • Redefine the lock screen shortcut to Ctrl + Alt + L.
  • force Alt + TAB to switch only on current workspace (read more)
Categories: ubuntu Tags: , ,

What is dependency injection?

April 18, 2018 Leave a comment

See this blog post: Dependency Injection Demystified. In short: “Dependency injection means giving an object its instance variables.”. For a slightly longer explanation, read the blog post.

Reddit comments are here.

Categories: programming Tags: , ,

C# is awesome

April 12, 2018 Leave a comment

I started to play with C# and I really enjoy it. I found a great book that explains the concepts very well: The C# Player’s Guide by RB Whitaker. I found the 2nd edition in our library but it also has a 3rd edition.

I started a C# project, which is a collection of custom extensions. You can find it here: https://github.com/jabbalaci/JabbaCustomExtensions-for-C-Sharp.

I also have a little utility (written in Python) that facilitates C# development under Linux in the command-line: https://github.com/jabbalaci/C-Sharp-CLI-Helper.

I’m playing with C# under Linux. JetBrains has a cross-platform IDE for .NET called Rider. It works very well for me.

Links

Categories: book, csharp

[manjaro] edit PKGBUILD and install a package

March 30, 2018 Leave a comment

Problem
You try to install a package with “yaourt pkg_name” but the installation fails. How to edit the PKGBUILD file manually and then install the package?

Solution

$ cd /tmp
$ yaourt -G pkg_name
$ cd pkg_name
# modify the file PKGBUILD with your favourite text editor
$ makepkg -i

Where “pkg_name” is the name of the package you want to install.

Categories: manjaro Tags: , ,

pretty print a C# source code

March 29, 2018 Leave a comment

Problem
I wanted to print the page at https://learnxinyminutes.com/docs/csharp/, but the produced PDF was black and white, i.e. the syntax highlighting was lost. How to print a source code with colors?

Solution
I tried several browsers, several editors, but nothing worked. Then I found a LaTeX solution. The necessary files and the produced PDF output are here: https://github.com/jabbalaci/blog-assets/tree/master/20180329-print-CSharp-code.

I put here the LaTeX source:

\documentclass{article}
\usepackage{fancyhdr}
\pagestyle{fancy}
%% Define your header here.
%% See http://texblog.org/2007/11/07/headerfooter-in-latex-with-fancyhdr/
\fancyhead[CO,CE]{C\# Summary}

\usepackage[usenames,dvipsnames]{color}  %% Allow color names

%% The listings package will format your source code
\usepackage{listings}
\lstdefinestyle{customasm}{
  belowcaptionskip=1\baselineskip,
  xleftmargin=\parindent,
  language={[Sharp]C},
  breaklines=true, %% Wrap long lines
  basicstyle=\footnotesize\ttfamily,
  commentstyle=\itshape\color{Gray},
  stringstyle=\color{Black},
  keywordstyle=\bfseries\color{OliveGreen},
  identifierstyle=\color{blue},
  xleftmargin=-8em,
  showstringspaces=false
}
\begin{document}

\lstinputlisting[style=customasm]{src.cs}

\end{document}

The LaTeX tip is from here.

Categories: csharp, latex Tags:

[steam] get a game for a cheaper price

March 25, 2018 4 comments

Problem
You want to buy a game on Steam for a cheaper price. There are sales on Steam but you don’t want to check it every day.

Solution
There is a very simple way to get notified when the desired game becomes cheaper. Log in to Steam and add the game to your wishlist. I thought that the wishlist was just a simple list and never clicked on it but it’s more than that! When a game on your wishlist becomes cheaper, you get an e-mail notification. It’s that simple.

I wanted to build a web app. for this purpose :) Then I talked about it with a friend and he told me that the Steam wishlist can do that…

Categories: games Tags: ,