GithubHelp home page GithubHelp logo

achakravarti / misc-basile Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bstarynk/misc-basile

0.0 0.0 0.0 446 KB

Miscellaneous stuff, mostly single-file tiny programs (GPLv3+)

License: GNU General Public License v3.0

Shell 1.09% C++ 24.67% C 65.79% Emacs Lisp 0.40% OCaml 3.11% Common Lisp 0.10% Rust 0.19% TeX 3.57% Makefile 1.05% GDB 0.03%

misc-basile's Introduction

misc-basile

Miscellaneous stuff, mostly single-file tiny programs

Email me to [email protected] for feedback and questions. See starynkevitch.net/Basile for more about me, with this being in English. My pet project is RefPerSys.

Several single source file programs usually for GNU/Linux/Debian/x86-64. Their compilation command is generally given as a comment inside the source code.

  • manydl.c is a program to show that Linux is capable of dlopen-ing many plugins (typically, several hundred thousands or many millions). It works by generating some pseudo-random C file, compiling it into a plugin, which is later dlopen-ed, and repeat.

  • forniklas.c is a trivial C program generating then using one single plugin in C. Read its comments for more details.

  • redis-scan.c is a program which scans all the keys in a REDIS database (see http://redis.io/ for more) and prints them on stdout.

  • execicar.c is a shell-like program interpreting commands on pipes, etc.

  • basilemap.ml is a simple exercise to understand the balanced binary trees of the Ocaml stdlib/map.ml file, which I might simplify a bit.

  • bwc.c is a crude wc -l like program using getline; for performance benchmarking.

  • half.c is a program to stop/cont-inue a command, running it at half load. It was originally written to overcome a hardware bug on an old MSI-270 Turion laptop. It might be useful today to "emulate" bugs by sending periodically an arbitrary signal (such as SIGSEGV or SIGABRT) to a command.

  • microbenchlist.c is a useless microbenchmark on linked lists use gcc -Wall -O2 -march=native microbenchlist.c -o microbenchlist to compile it.

  • makeprimes.c uses the very clever BSD /usr/games/primes program and extract some primes from the stream of primes producing it.

  • sync-periodically.c runs periodically the sync(2). Please glance inside the source code. Our /etc/crontab might have a line like

@reboot   sync    /usr/local/bin/sync-periodically 3 2000
  • qfontdialog-example.cc is a tiny improvement over this QFontDialog example

  • HelloWorld/ contains a small set of files and its README, for a tutorial about GNU make (done on the phone). Perhaps the GPLv3+ license does not fit for such a trivial work.

  • onionwebsocket.c is a slighty improved example of websockets from libonion. Most of the code is not mine.

  • foldexample.cc is interesting, since it shows how recent C++ compilers are capable of very deep optimizations

  • fox-tinyed.cc is for learning the FOX toolkit - a tiny editor (perhaps incomplete).

  • fltk-mini-edit.cc is for learning the FLTK toolkit - a tiny editor (perhaps incomplete). It accepts some JSONRPC inspired protocol, documented in file mini-edit-JSONRPC.md.

  • logged-gcc.cc is a (GPLv3 licensed) wrapper (coded in C++) around compilation commands by GCC to log them (and their time) with syslog(3) and/or some Sqlite database. You will compile it using compile-logged-gcc.sh. See also this.

Using logged-gcc

You first need to compile logged-gcc.cc with the compile-logged-gcc.sh shell script. You might want to edit that script. It produces a logged-gcc executable which you could put into your $HOME/bin/ directory.

You then should change your $PATH variable in such a way that $HOME/bin/ is in front of the directory containing your system gcc, usually /usr/bin/. You might have something like export PATH=$HOME/bin:/usr/bin:/bin in some shell initialization file (e.g. $HOME/.bashrc or $HOME/.zshrc for zsh users).

You could run logged-gcc --help to get some help, and logged-gcc --version for version information.

You then add symbolic links with ln -sv $HOME/bin/logged-gcc $HOME/bin/gcc and ln -sv $HOME/bin/logged-gcc $HOME/bin/g++

You could set environment variables $LOGGED_GCC to e.g. /usr/bin/gcc-10 and $LOGGED_GXX to e.g. /usr/bin/g++-10. See also environ(7).

If you want to use logged-gcc with just syslog(3), you don't need to do anything more.

If you want to use logged-gcc with some Sqlite database such as /tmp/logged-gcc.sqlite, you need first to initialize it using logged-gcc --sqlite=/tmp/logged-gcc.sqlite (before any /tmp/logged-gcc.sqlite file exists), and then set the environment variable $LOGGED_SQLITE to /tmp/logged-gcc.sqlite. Only successful GCC compilations go into that database.

misc-basile's People

Contributors

bstarynk avatar achakravarti avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.