diff options
Diffstat (limited to '00_blog/00035_Programming')
30 files changed, 457 insertions, 1 deletions
diff --git a/00_blog/00035_Programming/00020_Computer-Science-Literature/index.md b/00_blog/00035_Programming/00008_Computer-Science-Literature/index.md index 114294e..114294e 100644 --- a/00_blog/00035_Programming/00020_Computer-Science-Literature/index.md +++ b/00_blog/00035_Programming/00008_Computer-Science-Literature/index.md diff --git a/00_blog/00035_Programming/00018_Building/00030_The-Hell-of-Autotools/index.md b/00_blog/00035_Programming/00018_Building/00030_The-Hell-of-Autotools/index.md new file mode 100644 index 0000000..746bd82 --- /dev/null +++ b/00_blog/00035_Programming/00018_Building/00030_The-Hell-of-Autotools/index.md @@ -0,0 +1,74 @@ +The Hell of Autotools +===================== + March 19, 2018 +In this trivial example we compile a custom **webkit2gtk+ extension** with +**autotools**. For a start we need to provide two files, `Makefile.am` +and `configure.ac`, beside our actual `ext.c` source file, which contains +the extension code itself. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.c .numberLines} +// File: ext.c // + +#include <webkit2/webkit-web-extension.h> + +G_MODULE_EXPORT void +webkit_web_extension_initialize_with_user_data (WebKitWebExtension *extension, + GVariant *user_data) +{ + g_print("Hello Extension!\n"); +} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.makefile .numberLines} +# File: Makefile.am # + +webextension_LTLIBRARIES = libmyappwebextension.la +webextensiondir = /home/miguel/temp + +WEB_EXTENSION_CFLAGS = `pkg-config --cflags webkit2gtk-web-extension-4.0` +WEB_EXTENSION_LIBS2 = `pkg-config --libs webkit2gtk-web-extension-4.0` + +libmyappwebextension_la_SOURCES = ext.c +libmyappwebextension_la_CFLAGS = $(WEB_EXTENSION_CFLAGS) +libmyappwebextension_la_LIBADD = $(WEB_EXTENSION_LIBS) +libmyappwebextension_la_LDFLAGS = -module -avoid-version -no-undefined $(WEB_EXTENSION_LIBS2) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.makefile .numberLines} +# File: configure.ac # + +AC_PREREQ([2.69]) +AC_INIT(ext,0.1,test@example.com) +AM_INIT_AUTOMAKE +AC_CONFIG_SRCDIR([ext.c]) +AC_PROG_CC +LT_INIT +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Put the above files in a new fresh directory and you are ready to see the +powers of autotools in action. + +Run the following commands on your pash prompt: + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash} +touch NEWS README AUTHORS ChangeLog +aclocal +autoconf +automake --add-missing +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +After this steps, we end up with 18 files in our directory. Finally we +can _configure_, _build_ and _install_ our extension. The following +commands will probably look familiar. Note that the _configure_ step +generates 6 additional files, totaling in **24 files** before the actual +_make_ command is run. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash} +./configure +make +make install +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +... just to compile one **single C file**. diff --git a/00_blog/00035_Programming/00018_Building/00040_Various-notes-on-Building/index.md b/00_blog/00035_Programming/00018_Building/00040_Various-notes-on-Building/index.md new file mode 100644 index 0000000..0639063 --- /dev/null +++ b/00_blog/00035_Programming/00018_Building/00040_Various-notes-on-Building/index.md @@ -0,0 +1,93 @@ +# Various Notes on Building + +## Webkit + +Let’s compile a release with debug info and install to /usr/local + +~~~~~~ {.bash} +wget https://webkitgtk.org/releases/webkitgtk-2.20.0.tar.xz +tar -xvf webkitgtk-2.20.0.tar.xz +cd webkitgtk-2.20.0 +# install all the libs that will be reported missing in the next step. +# I could not find the woff2 stuff in debian so skipped it... +cmake -DPORT=GTK -DCMAKE_BUILD_TYPE=RelWithDebInfo -DUSE_WOFF2=NO -GNinja +# this takes about 30minutes on my i7-4790K .. zzzzz..zzz +ninja +sudo ninja install +~~~~~~~~~~~ + + pkg-config + + pkg-config uses our new build now: + + [1] https://trac.webkit.org/wiki/BuildingGtk + [2] https://webkitgtk.org/ + +## GCC + +This is how I build gcc (5.2.0) and binutils (2.25.1). Check [5] first. + +* unpack binutils-x.y.z +* create a new directory binutils-x.y.z-build and inside it run the following commands: + +~~~~~~ {.bash} + $ ../binutils-x.y.z/configure --disable-nls --with-sysroot --enable-targets=all + $ make -j4 + $ make install +~~~~~~~~~~~~ + +* unpack gcc-x.y.z and run the contrib/download_prerequisites script inside. +* create a new directory: gcc-x.y.z-build and inside it run: + +~~~~~~ {.bash} + $ ../gcc-x.y.z/configure --disable-nls --enable-languages=c,c++ --enable-threads + $ make -j4 + $ make install +~~~~~~~~~~~~ + + REF: + + [1] binutils and gcc README files. + [2] https://gcc.gnu.org/install/ + [3] http://wiki.osdev.org/Building_GCC + [4] http://stackoverflow.com/questions/1726042/recipe-for-compiling-binutils-gcc-together + [5] https://gcc.gnu.org/install/prerequisites.html + +## Linux + + cd linux-source-[xxx] + make mrproper + cp someconfig .config -i + make oldconfig + make menuconfig + make localmodconfig + make localyesconfig + make + (OPT) make modules + su + make install + (OPT) make modules_install + (OPT) update-intiramfs -c -k [kernel-postfix] + + (REMOVE UNWANTED FILES FROM BOOT!) + update-grub + grub-install /dev/sda + reboot + + +## Clang + + http://llvm.org/releases/3.7.0/docs/CMake.html + http://clang.llvm.org/get_started.html + put MAKEFLAGS="-j8" or similar in front of your CMake invocations. + + extracted llvm to ~/temp/clang/llvm-3.7.0.src/ + extracted clang to ~/temp/clang/llvm-3.7.0.src/tools/clang/ + extracted compiler-rt to ~/temp/clang/llvm-3.7.0.src/projects/compiler-rt + extracted libcxx to ~/temp/clang/llvm-3.7.0.src/projects/libcxx + + $ cd ~/temp/clang/llvm-3.7.0-build + $ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/home/miguel/opt/llvm-3.7.0 ../llvm-3.7.0.src + $ cmake --build . + $ cmake --build . --target install + diff --git a/00_blog/00035_Programming/00018_Building/index.md b/00_blog/00035_Programming/00018_Building/index.md new file mode 100644 index 0000000..1ee18e7 --- /dev/null +++ b/00_blog/00035_Programming/00018_Building/index.md @@ -0,0 +1,3 @@ +# Building + +Some Random Notes about Building Software. diff --git a/00_blog/00035_Programming/00010_IPC/.index.md.swp b/00_blog/00035_Programming/00020_IPC/.index.md.swp Binary files differindex 87e0eaa..87e0eaa 100644 --- a/00_blog/00035_Programming/00010_IPC/.index.md.swp +++ b/00_blog/00035_Programming/00020_IPC/.index.md.swp diff --git a/00_blog/00035_Programming/00010_IPC/index.md b/00_blog/00035_Programming/00020_IPC/index.md index e42e38f..e42e38f 100644 --- a/00_blog/00035_Programming/00010_IPC/index.md +++ b/00_blog/00035_Programming/00020_IPC/index.md diff --git a/00_blog/00035_Programming/00030_Mandelmaister/1.jpg b/00_blog/00035_Programming/00030_Mandelmaister/1.jpg Binary files differnew file mode 100644 index 0000000..baad9c8 --- /dev/null +++ b/00_blog/00035_Programming/00030_Mandelmaister/1.jpg diff --git a/00_blog/00035_Programming/00030_Mandelmaister/2.jpg b/00_blog/00035_Programming/00030_Mandelmaister/2.jpg Binary files differnew file mode 100644 index 0000000..bb82f07 --- /dev/null +++ b/00_blog/00035_Programming/00030_Mandelmaister/2.jpg diff --git a/00_blog/00035_Programming/00030_Mandelmaister/3.jpg b/00_blog/00035_Programming/00030_Mandelmaister/3.jpg Binary files differnew file mode 100644 index 0000000..4fab9a8 --- /dev/null +++ b/00_blog/00035_Programming/00030_Mandelmaister/3.jpg diff --git a/00_blog/00035_Programming/00030_Mandelmaister/4.jpg b/00_blog/00035_Programming/00030_Mandelmaister/4.jpg Binary files differnew file mode 100644 index 0000000..8f5054e --- /dev/null +++ b/00_blog/00035_Programming/00030_Mandelmaister/4.jpg diff --git a/00_blog/00035_Programming/00030_Mandelmaister/index.md b/00_blog/00035_Programming/00030_Mandelmaister/index.md new file mode 100644 index 0000000..0224c1e --- /dev/null +++ b/00_blog/00035_Programming/00030_Mandelmaister/index.md @@ -0,0 +1,44 @@ + June 2008
+# Mandelmaister - Mandelbrot Fractal Viewer
+
+My old **Mandelbrot** viewer coded in Java long time ago.
+
+{}\
+
+## Supported Set
+
+The Mandelbrot Set $$z_n^2+c$$
+
+## JAR File
+
+JAR Download: [mandelmaister.jar](mandelmaister.jar)
+
+You can run the jar file as follows:
+
+ java -jar mandelmaister.jar
+
+## Source Code
+
+Download: [src.rar](src.rar)
+
+## Howto/Instructions
+
+* Click left mouse button at two positions to define vertices of rectangle for zooming in.
+* Right mouse button to return to initial view.
+* increase iterations for big magnifications: Options -> Iterations.
+* The rendered area casn be saved as jpeg : File->Save Image.
+* Different coloring modes are available under Coloring.
+* Color Wrap and initial shift (0-1) can be also set untder Coloring->Color options.
+* Options->GOto allows to specify valus for cx and cy, and also check current location.
+
+## Limitations & Bugs
+
+The zoom-in depth is limited due to the double number format precision.
+changing to BigDecimal would fix this issue.
+The y axis is flipped!
+
+## Screenshots
+{}\
+{}\
+{}\
+{}\
diff --git a/00_blog/00035_Programming/00030_Mandelmaister/mandelmaister.jar b/00_blog/00035_Programming/00030_Mandelmaister/mandelmaister.jar Binary files differnew file mode 100644 index 0000000..bbfe384 --- /dev/null +++ b/00_blog/00035_Programming/00030_Mandelmaister/mandelmaister.jar diff --git a/00_blog/00035_Programming/00030_Mandelmaister/shot.jpg b/00_blog/00035_Programming/00030_Mandelmaister/shot.jpg Binary files differnew file mode 100644 index 0000000..7d2f0f0 --- /dev/null +++ b/00_blog/00035_Programming/00030_Mandelmaister/shot.jpg diff --git a/00_blog/00035_Programming/00030_Mandelmaister/src.rar b/00_blog/00035_Programming/00030_Mandelmaister/src.rar Binary files differnew file mode 100644 index 0000000..27a6941 --- /dev/null +++ b/00_blog/00035_Programming/00030_Mandelmaister/src.rar diff --git a/00_blog/00035_Programming/00040_3DS-Loader/3ds_1.png b/00_blog/00035_Programming/00040_3DS-Loader/3ds_1.png Binary files differnew file mode 100644 index 0000000..39fbe2b --- /dev/null +++ b/00_blog/00035_Programming/00040_3DS-Loader/3ds_1.png diff --git a/00_blog/00035_Programming/00040_3DS-Loader/3ds_2.png b/00_blog/00035_Programming/00040_3DS-Loader/3ds_2.png Binary files differnew file mode 100644 index 0000000..90c41f6 --- /dev/null +++ b/00_blog/00035_Programming/00040_3DS-Loader/3ds_2.png diff --git a/00_blog/00035_Programming/00040_3DS-Loader/3ds_3.png b/00_blog/00035_Programming/00040_3DS-Loader/3ds_3.png Binary files differnew file mode 100644 index 0000000..c61bec8 --- /dev/null +++ b/00_blog/00035_Programming/00040_3DS-Loader/3ds_3.png diff --git a/00_blog/00035_Programming/00040_3DS-Loader/3ds_4.png b/00_blog/00035_Programming/00040_3DS-Loader/3ds_4.png Binary files differnew file mode 100644 index 0000000..b1d88d7 --- /dev/null +++ b/00_blog/00035_Programming/00040_3DS-Loader/3ds_4.png diff --git a/00_blog/00035_Programming/00040_3DS-Loader/3ds_5.png b/00_blog/00035_Programming/00040_3DS-Loader/3ds_5.png Binary files differnew file mode 100644 index 0000000..ad77647 --- /dev/null +++ b/00_blog/00035_Programming/00040_3DS-Loader/3ds_5.png diff --git a/00_blog/00035_Programming/00040_3DS-Loader/index.md b/00_blog/00035_Programming/00040_3DS-Loader/index.md new file mode 100644 index 0000000..37c5ea2 --- /dev/null +++ b/00_blog/00035_Programming/00040_3DS-Loader/index.md @@ -0,0 +1,18 @@ + August 2001 +# Loader for the 3DS File Format + +Long ago I created this little loader for the binary 3DS file format, when +exploring its chunk based nature. It only supports a small subset of chunk IDs, +yet enough to get the faces and vertices. + +As you see the default color-scheme is somehow inspired by the good old C64 :smile: + +{}\ +{}\ +{}\ +{}\ +{}\ + +<!-- +I keep it locally in ~/nogit/loader_3ds_files +--> diff --git a/00_blog/00035_Programming/00040_Hex-Converter/hex.png b/00_blog/00035_Programming/00040_Hex-Converter/hex.png Binary files differnew file mode 100644 index 0000000..2c2ecf0 --- /dev/null +++ b/00_blog/00035_Programming/00040_Hex-Converter/hex.png diff --git a/00_blog/00035_Programming/00040_Hex-Converter/hexman.html b/00_blog/00035_Programming/00040_Hex-Converter/hexman.html new file mode 100644 index 0000000..86af3ef --- /dev/null +++ b/00_blog/00035_Programming/00040_Hex-Converter/hexman.html @@ -0,0 +1,170 @@ +<body> + <head> + <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous"> + <script> + var radix_str="26"; + + var str_map = {}; + str_map[777] = "Jackpot! You are Lucky Today!"; + str_map[13] = "Bad Bad Bad"; + str_map[666] = "The Number of the Beast."; + + function toggle_bin() { + var x = document.getElementById("details_bin"); + if (x.style.display === "none") { + x.style.display = "flex"; + } else { + x.style.display = "none"; + } +} + + function convert(val,rad) + { + if(val=="")return; + + /* guard radix */ + var oldradix=radix_str; + + radix_str=document.getElementById("custom_radix").value; + var radix=parseInt(radix_str,10); + + if(!radix || radix <2 || radix > 36)radix_str=oldradix + document.getElementById("custom_radix").value=radix_str; + var radix=parseInt(radix_str,10); + // + + var i=parseInt(val,rad); + if(i) + { + document.getElementById("custom").value = i.toString(radix); + document.getElementById("dec").value = i.toString(10); + document.getElementById("oct").value = i.toString(8); + document.getElementById("bin").value = i.toString(2); + document.getElementById("hex").value = i.toString(16); + + + var bytes="<p>"; + + for(var j=0;j<32;j++) + { + bytes+="byte "+j.toString(10)+" : "+(((i&(2**j))>0)?"1":"_")+"<br />"; + } + bytes+="</p>"; + document.getElementById("bytes").innerHTML=bytes; + } + + var info=str_map[i]; + + if(info) + { + document.getElementById("info").innerHTML = i.toString(10) + " - " + info; //"Page location is " + window.location.href; + } + else + { + document.getElementById("info").innerHTML = ""; + } + + } + </script> + <style> + </style> + </head> + <html> + + <div class="container"> + + <div class="row"> + <div class="col-4"></div> + <div class="col-4"> + <h1 class="text-primary">Miguel's Converter</h1> + <p>Convert numbers between different bases. Supports decimal, octal, binary and hex. You can use a custom base as well.</p> + </div> + <div class="col-4"></div> + </div> + + <div class="row"> + <div class="col-4"></div> + <div class="col-4"> + <input id='dec' class="w-100 mb-3" type=text placeholder="decimal" name="dec" onkeyup="convert(this.value,10)" /> + </div> + <div class="col-1"> + 10 + </div> + <div class="col-3"></div> + </div> + + <div class="row"> + <div class="col-4"></div> + <div class="col-4"> + <input id='oct' class="w-100 mb-3" type=text placeholder="octal" name="oct" onkeyup="convert(this.value,8)" /> + </div> + <div class="col-1"> + 8 + </div> + <div class="col-3"></div> + </div> + + <div class="row"> + <div class="col-4"></div> + <div class="col-4"> + <input id='bin' class="w-100 mb-3" type=text placeholder="binary" name="binary" onkeyup="convert(this.value,2)" /> + </div> + <div class="col-1"> + 2 + </div> + <div class="col-1"> + <button onclick="toggle_bin()"> + toggle + </button> + </div> + <div class="col-2"></div> + </div> + + <div id="details_bin" class="row" style="display:none"> + <div class="col-4"></div> + <div class="col-4" id='bytes'> + Need value first. + </div> + <div class="col-4"></div> + </div> + + <div class="row"> + <div class="col-4"></div> + <div class="col-4"> + <input id='hex' class="w-100 mb-3" type=text placeholder="hex" name="hex" onkeyup="convert(this.value,16)" /> + </div> + <div class="col-1"> + 16 + </div> + <div class="col-3"></div> + </div> + + <div class="row"> + <div class="col-4"></div> + <div class="col-4"> + <input id='custom' class="w-100 mb-3" type=text placeholder="custom" onkeyup="convert(this.value,document.getElementById('custom_radix').value)" /> + </div> + <div class="col-1"> + <input id='custom_radix' class="w-100 mb-3" type=text placeholder="radix" onkeyup="convert(document.getElementById('custom').value,this.value)" value="26" /> + </div> + <div class="col-3"></div> + </div> + <div class="row"> + <div class="col-4"></div> + <div class="col-4" id="info"> + </div> + <div class="col-4"></div> + </div> + <div class="row"> + <div class="col-4"></div> + <div class="col-4"> + <p>Hacked together by <a href=https://www.idziorek.net>miguel</a></p> + <p>powered by JavaScript and Bootstrap.</p> + </div> + <div class="col-4"></div> + </div> + + + + </html> +</body> diff --git a/00_blog/00035_Programming/00040_Hex-Converter/index.md b/00_blog/00035_Programming/00040_Hex-Converter/index.md new file mode 100644 index 0000000..a65501d --- /dev/null +++ b/00_blog/00035_Programming/00040_Hex-Converter/index.md @@ -0,0 +1,10 @@ + August 2018 +# Hex Converter + +This is my little javascript online converter, that can translate +numbers between different bases: + +{width=400px} + +You can try it online [here](hexman.html). + diff --git a/00_blog/00035_Programming/00050_Optimialius-Square-Packing/index.md b/00_blog/00035_Programming/00050_Optimialius-Square-Packing/index.md new file mode 100644 index 0000000..5d9b71d --- /dev/null +++ b/00_blog/00035_Programming/00050_Optimialius-Square-Packing/index.md @@ -0,0 +1,15 @@ + December 2004 +# Optimalius + +A holistic solution for a polish foil reselling company, focusing on +optimal square packing,.. beside managing their repository and billing. + +A quick heuristic was used to calculate satisfying layouts in feasible time. + +{width=400px}\ +{width=400px}\ +{width=400px}\ + +<!-- +stored locally at ~/nogit/optimalius/ +--> diff --git a/00_blog/00035_Programming/00050_Optimialius-Square-Packing/opt1.png b/00_blog/00035_Programming/00050_Optimialius-Square-Packing/opt1.png Binary files differnew file mode 100644 index 0000000..0cd73b6 --- /dev/null +++ b/00_blog/00035_Programming/00050_Optimialius-Square-Packing/opt1.png diff --git a/00_blog/00035_Programming/00050_Optimialius-Square-Packing/opt2.png b/00_blog/00035_Programming/00050_Optimialius-Square-Packing/opt2.png Binary files differnew file mode 100644 index 0000000..3e53659 --- /dev/null +++ b/00_blog/00035_Programming/00050_Optimialius-Square-Packing/opt2.png diff --git a/00_blog/00035_Programming/00050_Optimialius-Square-Packing/opt3.png b/00_blog/00035_Programming/00050_Optimialius-Square-Packing/opt3.png Binary files differnew file mode 100644 index 0000000..cf423d1 --- /dev/null +++ b/00_blog/00035_Programming/00050_Optimialius-Square-Packing/opt3.png diff --git a/00_blog/00035_Programming/00100_Webkit-Keyboardless-Navigation/index.md b/00_blog/00035_Programming/00100_Webkit-Keyboardless-Navigation/index.md new file mode 100644 index 0000000..224c9bb --- /dev/null +++ b/00_blog/00035_Programming/00100_Webkit-Keyboardless-Navigation/index.md @@ -0,0 +1,29 @@ + April 2018 +Miguel's Surfing Quick Links +============================ + +Since I do not want to depend on JavaScript all of the time, I tried to +integrate simple keyboard-only navigation directly into the webkit2gtk+, +as a web extension. + +I use simple unix pipes for communication between the +main thread and my webextension. + +__Please note that this is a work in progress!__ + +You can take a look at both branches at my git repo: [https://gitweb.softwarefools.com/?p=miguel/surf-webext-dom.git](https://gitweb.softwarefools.com/?p=miguel/surf-webext-dom.git). + +The DOM is manipulated on the fly by the browser without any JavaScript involved. + +A little video demonstrating what was achieved so far (inside the glorious, webkit2gtk+ based, suckless surf browser): + +<video controls> + <source src="v1.mp4" type="video/mp4"> + <source src="v1.ogv" type="video/ogg"> +Your browser does not support the video tag. + +</video> + +The browser itself can be found here: [https://surf.suckless.org/](https://surf.suckless.org/). + + diff --git a/00_blog/00035_Programming/00100_Webkit-Keyboardless-Navigation/v1.ogv b/00_blog/00035_Programming/00100_Webkit-Keyboardless-Navigation/v1.ogv Binary files differnew file mode 100644 index 0000000..a086103 --- /dev/null +++ b/00_blog/00035_Programming/00100_Webkit-Keyboardless-Navigation/v1.ogv diff --git a/00_blog/00035_Programming/index.md b/00_blog/00035_Programming/index.md index 3424ab3..ab14eed 100644 --- a/00_blog/00035_Programming/index.md +++ b/00_blog/00035_Programming/index.md @@ -1,3 +1,3 @@ # Programming -Some programming related stuff. +Some programs and programming related stuff. |
