Archive

Archive for the ‘Uncategorized’ Category

listen to Pandora Radio, even if you are not a US citizen

April 21, 2016 Leave a comment

Problem
If you are a peasant like me living outside of the US but you still want to listen to Pandora Radio, which is only available in the center of world (USA), then what can you do?

Solution
There is a very simple solution now. Opera offers free VPN, built directly in the browser. You can choose between German, Canadian or American VPNs. Currently this feature is only available in the development version of Opera. So here are the steps:

  1. install Opera (development version)
  2. install Flash player for Opera (Pandora is a Flash-based website)
  3. visit pandora.com just to see that you are kicked out
  4. enable VPN: with Alt+P you can access the Settings, go to Privacy & security, then enable VPN
  5. Open an arbitrary site. On the left side of the URL bar you’ll see that VPN is activated. Click on it and select United States.
  6. Visit pandora.com again. Strangely, you are let in this time…

hacking with URL shorteners

April 18, 2016 Leave a comment

This article (https://freedom-to-tinker.com/blog/vitaly/gone-in-six-characters-short-urls-considered-harmful-for-cloud-services/) just gave me an excellent idea…

In a nutshell: these URLs are so short that you can explore a lot of them with a simple brute force approach. Just generate a random hash and there is a high chance that it points to somewhere.

Example: with bit.ly I generated a link: http://bit.ly/1bNGJd3 . I tried to modify some characters in the hash and in most cases it pointed to somewhere…

syntax highlight your code and paste in Word

April 14, 2016 1 comment

At http://planetb.ca/syntax-highlight-word you can find a nice syntax highlighter. It supports Python, HTML, Java, and several other languages. The rendered output can be copy-pasted to a Word document and it’ll look the same and remains editable in Word. Pretty cool.

It’s also useful if you want to make a screenshot of the syntax highlighted code. Here is an example:

sum

Thanks to Peter F. for the link.

using git like svn

March 15, 2016 Leave a comment

Problem
I have a Digital Ocean virtual private server (VPS) where I want to run a Python-Flask project of mine. The application works well on localhost, so it’s time to make it public.

However, it’s very likely that I will have to customize it a bit on the server, and thus I would like to get those changes on my localhost too. And vice versa, if I do some changes on localhost, I want to upload the new version to the server too. Copying everything via FTP for instance is out of the question. How to do it then?

Solution
Let’s use Git. Bitbucket offers free private repositories, so let’s profit of that :) I want to use that repo similarly to SVN: it’s the central repo, it must contain the latest version.

git_like_svn

Let “client A” be the VPS and “client B” my home machine (see the figure). When I modify something on localhost, upload the changes to the central repo, log in to the server and download the latest edition. If I modify something on the server, upload the changes to the central repo, and download them on my localhost. This way the two clients are nicely synchronized.

How to upload?
Upload your local changes to the central repo:

$ git status
$ git add -A .
$ git commit -m "your commit message"
$ git push
$ git status

How to download?
Download changes from the central repo (update your local copy):

#!/usr/bin/env bash

# git_down_from_central_repo.sh

git fetch
git pull
git status

But… it’s SVN like this!
Works for me :)

2015 in review

December 31, 2015 Leave a comment

The WordPress.com stats helper monkeys prepared a 2015 annual report for this blog.

Here's an excerpt:

The Louvre Museum has 8.5 million visitors per year. This blog was viewed about 140,000 times in 2015. If it were an exhibit at the Louvre Museum, it would take about 6 days for that many people to see it.

Click here to see the complete report.

Categories: Uncategorized Tags: ,

LaTeX: horizontal line

December 15, 2015 Leave a comment
\newcommand\sep{\noindent\rule[0.5ex]{\linewidth}{1pt}}

Usage:

text

\sep

go on

battle test your server with siege

December 1, 2015 Leave a comment

Siege is a multi-threaded http load testing and benchmarking utility. It was designed to let web developers measure the performance of their code under duress. It allows one to hit a web server with a configurable number of concurrent simulated users. … Performance measures include elapsed time, total data transferred, server response time, its transaction rate, its throughput, its concurrency and the number of times it returned OK.” (source)

Here is a gist that shows how to use it.

Warning! Use siege only on your sites since it can be interpreted as a DDOS attack.

Categories: bash, Uncategorized Tags: , ,
Follow

Get every new post delivered to your Inbox.

Join 87 other followers