thorko.deLinux / Unix systems administrator

GitLab Projects

buildserver Build Status Coverage Status

kupfer plugins

 

Latest SysadminDB entries

search


CopyQ is a clipboard manager which supports custom commands on selections.

It is very handy to select some text and search it in Google. Open CopyQ main window and hit F6 for the command window. Add a new command and select "Global Shortcut". Set your shortcut and in the command window, paste this script

copyq: var cmd = "chrome";
select(0);
var search = "https://www.google.de/search?q=" + str(clipboard());
execute(cmd, search);

Hit on ok.
Select your text and hit your choosen shortcut. It'll open Google in chrome and search for your selected text. 




Recoll is a desktop full-text search tool. 

Here are some useful hints. 

To index .md files add the following line to .recoll/mimemap

.md = text/plain

Do a more advanced search

"arch"C AND "btrfs|install"r AND -dir:.icedove

search for arch (case sensitive) and a regular match on btrfs or install and exclude .icedove directory




Howto map your X display to a container

Sometimes you want to use your X display in a container, for instance to start firefox.

On your host run

xhost +

This will allow anyone to connect to your Xorg server

Now you can start your container 

docker run -ti --memory 2gb --rm -e DISPLAY=unix:0 -v /tmp/.X11-unix:/tmp/.X11-unix -v=/dev/dri:/dev/dri:rw myimage mycmd



Debian - Downgrade package

Make sure your /etc/apt/sources.list contains different releases

deb http://ftp.de.debian.org/debian/ unstable main contrib non-free
deb-src http://ftp.de.debian.org/debian/ unstable main contrib non-free
deb http://ftp.de.debian.org/debian/ buster main contrib non-free
deb-src http://ftp.de.debian.org/debian/ buster main contrib non-free

Create a file called /etc/apt/apt.conf.d/80targetrelease

APT::Default-Release "sid";

This is your default release, which apt tries to install the package available on that mirror

If you want to install an old version you have to run

~$ apt-get -t buster install perl-base=5.24.1-7

This installs the perl-base package version 5.24.1-7 if it is available in buster release




Cgroups on Debian

~$ apt-get install cgroup-bin cgroup-tools

Create systemd unit files

/etc/systemd/system/cgred.service

# This is a mostly empty service, but allows commands like stop, start, reload
# to propagate to all tinc@ service instances.
[Unit]
Description=Cgroup Rules Engine
After=network.target cgconfig.service
[Service]
Type=forking
EnvironmentFile=-/etc/default/cgred.conf
ExecStart=/usr/sbin/cgrulesengd -f $LOG_FILE $LOG
ExecStop=/bin/kill -TERM ${MAINPID}
ExecReload=/bin/kill -12 ${MAINPID}
[Install]
WantedBy=multi-user.target

/etc/systemd/system/cgconfig.service

[Unit]
Description=Cgroup Config Parser
After=network.target
[Service]
Type=oneshot
RemainAfterExit=true
EnvironmentFile=-/etc/default/cgconfig.conf
ExecStart=/usr/sbin/cgconfigparser -l $CONFIG_FILE
#ExecStop=/usr/sbin/cgclear -e -l $CONFIG_FILE
[Install]
WantedBy=multi-user.target

/etc/default/cgred.conf

LOG_FILE="/var/log/cgrulesengd.log"
LOG="-v"

/etc/default/cgconfig.conf

CONFIG_FILE="/etc/cgconfig.conf"

Create your config files

The following example will limit your email client thunderbird in cpu and memory

/etc/cgconfig.conf

group Email { 
perm {
task {
uid = <your username>;
gid = <your username>;
fperm = 774;
dperm = 775;
}
admin {
uid = <your username>;
gid = <your username>;
fperm = 774;
dperm = 775;
}
}
cpu {
cpu.cfs_quota_us="60000";
cpu.cfs_period_us="100000";
}
memory {
memory.limit_in_bytes="350M";
}
}

/etc/cgrules.conf

*:thunderbird cpu,memory /Email



(c) 2014 by thorko.de