tag:blogger.com,1999:blog-51317953077199410572023-11-16T09:12:18.885+03:00The Ulterior ZoneOccasional short mostly IT related notesLinulinhttp://www.blogger.com/profile/11310631781421943047noreply@blogger.comBlogger5125tag:blogger.com,1999:blog-5131795307719941057.post-32734413479278425242017-03-30T05:15:00.000+03:002017-03-30T05:15:04.039+03:00РКН головного мозга<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgBfke9pSelSmw7IWSa2O4vY7fkxo0ZshX04hKOcOvotEy2AGEfe1h0nEpfkg4oN_dvDw0qOyQQ0MSST7ULV8iKTvB2oqqfhgpofkGzPmjX3-clKvCccyZmx5uzsfRWQOEzA0rPLfziyaw/s1600/%25D1%2583%25D1%2582%25D0%25BE%25D1%2587%25D0%25BA%25D0%25B0.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgBfke9pSelSmw7IWSa2O4vY7fkxo0ZshX04hKOcOvotEy2AGEfe1h0nEpfkg4oN_dvDw0qOyQQ0MSST7ULV8iKTvB2oqqfhgpofkGzPmjX3-clKvCccyZmx5uzsfRWQOEzA0rPLfziyaw/s1600/%25D1%2583%25D1%2582%25D0%25BE%25D1%2587%25D0%25BA%25D0%25B0.png" /></a></div>
<pre>
<i>Провайдер:</i> ТТК (ТрансТелеКом)
<i>Цель:</i> trello.com ... <b>FAILED!</b>
<i>WTF?</i> http://help.trello.com/article/771-loading-resources-from-trellos-cdn
<i>Проверка:</i> https://d78fikflryjgj.cloudfront.net/test.html ... <b>FAILED!</b>
<i>Магия:</i>
-- begin --
$ telnet d78fikflryjgj.cloudfront.net 443
Trying 54.192.98.126...
Trying 54.192.98.39...
Trying 54.192.98.107...
Trying 54.192.98.112...
Trying 54.192.98.253...
Trying 54.192.98.211...
Trying 54.192.98.106...
Trying 54.192.98.200...
telnet: Unable to connect to remote host: No route to host
$ sudo tcpdump -n -i eth1 icmp or host 54.192.98.39
... 188.43.30.130 > 10.0.0.2: ICMP host 54.192.98.39 unreachable
$ nslookup 188.43.30.130
... name = BlackList-gw.transtelecom.net.
-- end --
<i>Диагноз:</i> <b>РКН головного мозга</b>
<i>Подтверждение:</i> https://geektimes.ru/post/287418/#comment_9970944
</pre>Linulinhttp://www.blogger.com/profile/11310631781421943047noreply@blogger.comtag:blogger.com,1999:blog-5131795307719941057.post-40227744726158922052015-10-02T00:29:00.000+03:002015-10-02T00:31:54.420+03:00Auto-generated headers in qmake project files<p><i>qmake</i> is quite handy for simple source code layout but supporting non-standard use-cases within <i>qmake</i> boundaries is not trivial.</p>
<p>One such example is adding auto-generated header to your project. There are three items <i>qmake</i> must be made aware of before you get the expected and consistent results:</p>
<ul>
<li>arbitrary custom command for creating the header;</li>
<li>dependencies;</li>
<li>reverse dependencies from other files in the project.</li>
</ul>
<p>The following snippet shows how to properly convert these items into the actual qmake syntax for "python gen-hdr.py > auto-gen.h" command which depends on a couple of extra files:</p>
<span style="color: #666666;"><pre>
# This is a workaround to qmake bug (at least in 2.01a version) which
# results in invalid expansion of ${QMAKE_FILE_IN_PATH} variable within
# .commands definition in the presence of 'combine' .CONFIG option.
defineReplace(autoheadercmd) {
LIST = $${1}
return(python $$first(LIST) > $${2})
}
AUTOHEADER = gen-hdr.py hdr-template.py template-class.py
autohdr.CONFIG += combine
autohdr.input = AUTOHEADER
autohdr.output = auto-gen.h
autohdr.commands = ${QMAKE_FUNC_autoheadercmd}
autohdr.variable_out = HEADERS
QMAKE_EXTRA_COMPILERS = autohdr
</pre></span>
<p>This results in the following Makefile snippet:</p>
<span style="color: #666666;"><pre>
compiler_autohdr_make_all: auto-gen.h
compiler_autohdr_clean:
-$(DEL_FILE) auto-gen.h
auto-gen.h: gen-hdr.py \
hdr-template.py \
template-class.py
python gen-hdr.py > auto-gen.h
</pre></span>
<p>or the following, in case of separate build directory:</p>
<span style="color: #666666;"><pre>
compiler_autohdr_make_all: auto-gen.h
compiler_autohdr_clean:
-$(DEL_FILE) auto-gen.h
auto-gen.h: ../gen-hdr.py \
../hdr-template.py \
../template-class.py
python ../gen-hdr.py > auto-gen.h
</pre></span>
<p>Reverse dependencies are built automatically, and auto-gen.h will be properly listed where necessary in the Makefile, like this:</p>
<span style="color: #666666;"><pre>
user.o: ../user.c ../user.h auto-gen.h
$(CC) -c $(CFLAGS) $(INCPATH) -o user.o ../user.c
</pre></span>
<p>Correct reverse dependencies are especially important when using "make -j" for parallel compilation.</p>
<p><b>P.S.</b></p>
<p>See <a href="http://blog.mgsxx.com/?p=2201">qmake: генерация файлов с помощью QMAKE_EXTRA_COMPILERS</a> by <a href="http://stackoverflow.com/users/12151/sergey-skoblikov">Sergey Skoblikov</a> for extra details, and its <a href="http://blog.mgsxx.com/?page_id=1294">parent page</a> - for various other qmake-related topics. (Both are in Russian.)</p>Linulinhttp://www.blogger.com/profile/11310631781421943047noreply@blogger.comtag:blogger.com,1999:blog-5131795307719941057.post-79038757683011167112012-01-19T12:08:00.000+04:002012-01-19T12:08:44.615+04:00No Trust to X<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjnslcZM8mI4ONqgpLrdMiU8fFOd_JLWuucpd8DNbbclh20K_7Nc2BsjhbLtLrfx6-2RwVzds9oOQOo4XDKZPZQsKzHawS_GVVilRW8g69hmxHb4r9DjD3kX8dwfSH0gvPMbQrWNs3Vm3k/s1600/insecure-lock.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjnslcZM8mI4ONqgpLrdMiU8fFOd_JLWuucpd8DNbbclh20K_7Nc2BsjhbLtLrfx6-2RwVzds9oOQOo4XDKZPZQsKzHawS_GVVilRW8g69hmxHb4r9DjD3kX8dwfSH0gvPMbQrWNs3Vm3k/s320/insecure-lock.jpg" width="245" /></a></div>
<b><span style="font-family: "Courier New",Courier,monospace;">Ctrl+Alt+<Keypad *></span></b> - this is all you need nowadays to <a href="http://gu1.aeroxteam.fr/2012/01/19/bypass-screensaver-locker-program-xorg-111-and-up/">bypass screen lockers in X Server</a>. Although, I believe, this flaw will be fixed pretty soon, the trust is lost for ever, and I'm going back to roots by switching to X-independent "vlock".<br />
<br />
"<span style="font-family: "Courier New",Courier,monospace;">sudo vlock -na</span>" works even when called from X, and seems to be the most secure way to lock your machine, since virtual consoles are handled as well.<span style="font-size: x-small;"><span style="font-size: x-small;"><i> </i></span></span><br />
<span style="font-size: x-small;"><span style="font-size: x-small;"><i> (Make sure you remember root password before executing the above command.)</i></span></span>Linulinhttp://www.blogger.com/profile/11310631781421943047noreply@blogger.comtag:blogger.com,1999:blog-5131795307719941057.post-17169950346223723862011-03-17T17:15:00.000+03:002012-01-19T11:03:56.796+04:00Shell Poetry<div style="text-align: center;">If in script.sh you want to</div><div style="text-align: center;"><span class="Apple-style-span">echo err >/dev/stderr</span></div><div style="text-align: center;">then you should</div><div style="text-align: center;">echo err >>/dev/stderr</div><div style="text-align: center;">unless you plan to catch</div><div style="text-align: center;">only the last message</div><div style="text-align: center;">when running</div><div style="text-align: center;">script.sh 2>err.log</div><div style="text-align: center;"><br /></div><div style="text-align: center;">Forget all the above,</div><div style="text-align: center;">despite it works in many cases.</div><div style="text-align: center;">In fact, the only correct form is</div><div style="text-align: center;">echo err 1>&2</div>Linulinhttp://www.blogger.com/profile/11310631781421943047noreply@blogger.comtag:blogger.com,1999:blog-5131795307719941057.post-71605109663106485342007-07-22T20:07:00.000+04:002008-12-09T18:51:18.970+03:00Beyond Brightness and Contrast<img style="border: 1px solid ; margin: 0pt 0pt 10px 10px; float: right;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPihytWb83LunnhV36O7JZD9hyphenhyphen_IY92ItUsa_DoqV9l0bJ1ecpPIWwV86RnctLL7W3f30m04ngl_wKwJKlul5kKa_DChyphenhyphenOw0jQG2AT6IkWcGvmWk-SEB2k0dtnXxJXJHIrNNKEdlvMhZI/s400/digitaldog200.jpg" alt="[Digital Dog printer test image]" id="BLOGGER_PHOTO_ID_5090041221680735890" />When you occasionally open advanced display properties on your PC you might notice there is a tab for controlling <span style="font-style: italic;">gamma</span> parameters. I was always curious why gamma controls might be required and more importantly how to use them properly. Despite this fact I never had enough courage to get my teeth into the topic until today...<br /><br />Leaving aside a boring story of what finally pushed me beyond <span style="font-style: italic;">brightness</span> and <span style="font-style: italic;">contrast</span> monitor controls I just want to promote an <a href="http://www.normankoren.com/makingfineprints1A.html">excellent tutorial</a> by Norman Koren on <a href="http://www.normankoren.com/makingfineprints1B.html"><span style="font-style: italic;">monitor calibration</span><span> and </span><span style="font-style: italic;">gamma</span></a>.<br /><br />Linux users might want to start with <a href="http://www.linux.com/articles/113936"><span style="font-style: italic;">Monitor calibration under X</span></a> article at <a href="http://www.linux.com/">linux.com</a> which originally led me to the <a href="http://www.normankoren.com/">Norman's site</a>.Linulinhttp://www.blogger.com/profile/11310631781421943047noreply@blogger.com