Skip to content

Instantly share code, notes, and snippets.

@oboff
oboff / defer.hpp
Created February 18, 2024 06:51 — forked from pmttavara/defer.hpp
The definitive defer implementation for C++. Syntax: defer { statements; };
#ifndef defer
struct defer_dummy {};
template <class F> struct deferrer { F f; ~deferrer() { f(); } };
template <class F> deferrer<F> operator*(defer_dummy, F f) { return {f}; }
#define DEFER_(LINE) zz_defer##LINE
#define DEFER(LINE) DEFER_(LINE)
#define defer auto DEFER(__LINE__) = defer_dummy{} *[&]()
#endif // defer
@oboff
oboff / grub
Last active August 4, 2023 13:12
Realtek rtl8811CU kernel boot parameter to ignore device
GRUB_CMDLINE_LINUX_DEFAULT="usb-storage.quirks=0bda:1a2b:i"
@oboff
oboff / thinkpad-trackpoint-speed.mkd
Created October 9, 2015 05:34 — forked from noromanba/thinkpad-trackpoint-speed.mkd
change pointer speed of Trackpoint on Thinkpad T60

Thinkpad Trackpoint speed configuration on Linux

change pointer speed of Trackpoint on Thinkpad

works well T60 with Ubuntu 13.10 and Ubuntu 14.04 LTS

how to change

speed configration by write integer to file

0 <- slower ------------ faster -> 250

@oboff
oboff / books.cplusplus.md
Last active May 13, 2017 04:22
Books to Learn Formal Methods/C++

John Lakos

Books Recommended by Alexander Stepanov

  • Aho, Alfred Vaino, John Edward Hopcroft, and Jeffrey David Ullman. 1976. The design and analysis of computer algorithms. Reading, Mass. [usw.]: Addison-Wesley.
  • Stepanov, Alexander A. 2015. From mathematics to generic programming. Upper Saddle River, N.J. [etc.]: Addison-Wesley.
  • Stroustrup, Bjarne. 2013. The C++ programming language: [C++11]. Upper Saddle River (NJ) [etc.]: Addison-Wesley.

Formal Methods

Texts

/*
* Removes power management and keeps USB hard drive alive in Linux
* You can dissable the powermanagement of your device with the following command (no powermanagement = no spindown - no standby for the harddrive)
*/
hdparm -B 255 /dev/sdX
/*
* replace sdX with the name of your harddrive
* This will only last till you restart your pc.
@oboff
oboff / bluetooth.txt
Created June 30, 2016 09:27
Enabling Bluetooth A2DP in Stella 6.7
yum list
yum update pulseaudio
wget http://rpm.pbone.net/index.php3/stat/3/srodzaj/2/search/blueman-1.21-8.2.src.rpm
pair and connect with blueman

test blog

@oboff
oboff / log.md
Created June 12, 2016 07:25 — forked from mattstauffer/log.md
Introduction to Gistlog

So, you might be asking yourself, what is Gistlog?

Gistlog is a blogging "platform" for people who want to quickly write and publish content, in Markdown, and don't want to bother with yet another platform and yet another login and yet another group hoarding their content. With Gistlog, you use your pre-existing Github login, you store the data in your own Github account, and you can publish with a single click.

Using Gistlog

  1. Create a public gist with a single file using Markdown. Set the gist description to be the title of your blog post
  2. Copy the gist URL, and paste it into the text box on the Gistlog home page
  3. Copy your resulting URL and share it as your blog post--note that it will be in the form of http://gistlog.co/your-github-username/gist-id
  4. If you want to have your own Gistlog landing page (e.g. gistlog.co/mattstauffer), read all about it
@oboff
oboff / rotate.erl
Last active June 5, 2016 05:27
rotate list around list of Nth elements
-module(rotate).
-export([rotate/2]).
rotate(N, List) ->
if
is_number(N) ->
rot([N], List);
true -> rot(N, List)
end.