This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
import http.server | |
class MyHTTPRequestHandler(http.server.SimpleHTTPRequestHandler): | |
def end_headers(self): | |
self.send_my_headers() | |
http.server.SimpleHTTPRequestHandler.end_headers(self) | |
def send_my_headers(self): | |
self.send_header("Cache-Control", "no-cache, no-store, must-revalidate") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This example shows how $0 and the other $n fields change during the execution | |
of an AWK script. In a sense this is what using AWK is all about. | |
Consider the following awk script, with " 1 2 3 4 5" as input. | |
{ | |
print_fields(); | |
$1 = ""; | |
$3 = ""; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Install dependencies | |
$ sudo apt-get install libfltk1.3-dev install libboost-all-dev libxmu-dev | |
- Go to src/Makefile.am and add -lboost_system to LDADD, should be | |
LDADD= $(GUI_LD_ADD) $(XML_LD_ADD) $(PTHREAD_LD_ADD) -lboost_system | |
- Run regeneate makefiles with | |
$ aclocal; automake | |
- Run configure |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT ?code ?countryLabel ?coordinates WHERE | |
{ | |
?country wdt:P31 wd:Q3624078 ; | |
p:P625 ?location . | |
#not a former country | |
FILTER NOT EXISTS {?country wdt:P31 wd:Q3024240} | |
#and no an ancient civilisation (needed to exclude ancient Egypt) | |
FILTER NOT EXISTS {?country wdt:P31 wd:Q28171280} | |
# This doesn't bring all countries. It misses Armenia for example. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is a way of executing a different macro based on the number of argument | |
// passed to a macro with variable arguments. Essentially this is a way of | |
// executing macros conditionally even though C doesn't support using #if inside | |
// a macro definition. | |
// | |
// Source: https://stackoverflow.com/questions/3046889/optional-parameters-with-c-macros | |
// The multiple macros that you would need anyway [as per: Crazy Eddie] | |
#define XXX_0() <code for no arguments> | |
#define XXX_1(A) <code for one argument> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When using GTree I made the mistake of keeping pointers to keys and overwriting | |
them. I expected this would only affect the overwritten keys, and make lookups | |
for them return NULL. What actually happened was that other keys not related to | |
these became unaccessible. I am puzzled as to why this happened, it may be | |
interesting to dig inside GTree's implementation and see what's going on. | |
My guess is doing this breaks the sorted invariant of the tree, then things | |
will go crazy next time it tries to balance it, maybe for some reason it tries | |
to fix it by replacing existing keys?. Or, maybe the result of the string | |
comparison function does not really check for equallity, and instead has an |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Information on how to create a custom layout | |
https://medium.com/@damko/a-simple-humble-but-comprehensive-guide-to-xkb-for-linux-6f1ad5e13450 | |
https://github.com/damko/xkb_kinesis_advantage_dvorak_layout | |
Information about the RMLVO configuration format and syntax of the 'rules' file | |
http://who-t.blogspot.com/2008/09/rmlvo-keyboard-configuration.html | |
Very detailed description of how to configure XKB, it includes information about the syntax of .xkb files. | |
https://www.charvolant.org/doug/xkb/html/xkb.html |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Current (unresolved) keymap file | |
================================ | |
The following command prints one include statement for each component of the | |
current keymap: | |
$ setxkbmap -print | |
Note that this is not a resolved keymap file!. Quite the opposite, it shows | |
what will be passed to xkbcomp as components so that it resolves them to an |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The syntax for setting up a third level key in a .xkb file seems to be vey | |
picky, I still need to explore more xkbcomp's source code to know how things | |
work. | |
I noticed this because recently the way I used to define the AltGr key in my | |
custom layout stopped working. I'm not sure which commit in which project | |
caused this to stop working, could have been libxkbcommon (xkbcomp), xserver, | |
Gdk among others. What I do know is that suddenly pressing AltGr would set | |
GDK_MOD1_MASK in the received key release event. This modifier is treated by | |
Gdk (Together with GDK_CONTROL_MASK) as one that will NEVER serve to translate |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Compiled libraries from Gtk's Git repositoriy will end up inside <gtk repo>/gtk/.libs/. To run an application with these | |
libraries use: | |
LD_LIBRARY_PATH=<git repo>/gtk/.libs/ <app> | |
I normally call it from inside the repository using | |
LD_LIBRARY_PATH=./gtk/.libs/ ~/<app path> | |
NOTE: Gtk moved from Autotools to Meson, maybe this will put resulting libraries somewhere else. |
NewerOlder