27 Temmuz 2021 Salı

sftp komutu

Örnek
Şöyle yaparız. Kullanıcı ismi user, şifre ise xx şeklindedir. Her ikisi arasında da : karakteri bulunur
sftp://user:xx@test.com:22

25 Temmuz 2021 Pazar

cpulimit komutu - Kullanmayın

Giriş
Açıklaması şöyle
cpulimit is, in 2021, really not the kind of tool that you want to use, especially not with interactive software: it "throttles" processes (or unsuccessfully tries to, in your case) by stopping and resuming them via signals. Um. That's a terrible hack, and it leads to unreliability you really don't want in a modern browser that might well be processing audio and video, or trying to scroll smoothly.
Örnek
Şöyle yaparız
cpulimit -l 30 -- chromium --incognito

22 Temmuz 2021 Perşembe

chmod gid bit - Dosya Paylaşmak İçindir

Giriş
Açıklaması şöyle. Dizin için kullanılırsa, dizinde dosya oluşturulunca sahibinin grubuna değil, dizinin grubuna ait olur
chmod preserves a directory's set-user-ID and set-group-ID bits unless you explicitly specify otherwise. You can set or clear the bits with symbolic modes like u+s and g-s, and you can set (but not clear) the bits with a numeric mode.
Örnek - grup hakkı vermek
Gruba guid hakkı vermek için şöyle yaparız.
chmod g+s [path]
Örnek - grup hakkını almak
Şöyle yaparız.
% stat -c '%04a' ~/testdir
2700

% chmod g-w ~/testdir
% stat -c '%04a' ~/testdir
0700
Örnek - grup hakkı vermek
Elimizde bir grup olsun ve buna kullanıcıları ekleyelim
addgroup webimage

adduser user1 webimage
adduser user2 webimage
adduser www-data webimage
Gruptaki herkese yazma hakkı vermek için şöyle yaparız
sudo chmod g+s image/
Açıklaması şöyle
This will cause any file created in that directory to be owned by the same group as the directory. Thus, if image is owned by group webimage, any file created there will be owned by the group webimage. If also read and write permissions are set for the group, all members of the group will be able to update the file.

19 Temmuz 2021 Pazartesi

pthread_setaffinity_np metodu

Giriş
Bu metod standart olmayan GNU fonksiyonudur (_np uzantısı nonportable demek) ve threadin hangi mantıksal işlemciye bağlanmak istendiği belirtilir. Açıklaması şöyle
Platform specific API's do have the ability to specify specific logical core (or a set of such cores) for a software thread. For example, GNU has pthread_setaffinity_np.
Örnek
Şöyle yaparız.
int cpuNum = ...
cpu_set_t cpus;
CPU_ZERO(&cpus);
CPU_SET(cpuNum, &cpus);

if(pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpus) != 0)  {
...Error...
}

13 Temmuz 2021 Salı

openssl speed aracı

Örnek
Şöyle yaparız
OpenSSL> speed rsa
Örnek
Şöyle yaparız
openssl speed -evp aes-128-cbc aes-128-ctr

1 Temmuz 2021 Perşembe

isatty metodu

Örnek
Şöyle yaparız. Eğer terminale bağlıysa true döner.
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

int main(void)
{
  printf("%d\n", isatty(STDOUT_FILENO));

  return EXIT_SUCCESS;
}