عبد اللطيف ايمش - صفحة 7 - أكاديمية حسوب

أفضل وسطاء الخيارات الثنائية - العقل السليم | حقائق ومعلومات عامة

أفضل وسطاء الخيارات الثنائية - العقل السليم | حقائق ومعلومات عامة submitted by ksalim87 to u/ksalim87 [link] [comments]

الكورس الشامل لتعليم الخيارات الثنائية(قناص الاوبشن)

submitted by goodlove20 to binaryoption [link] [comments]

شرح التداول بالروبوت في بورصة الخيارات الثنائية iQBot

شرح التداول بالروبوت في بورصة الخيارات الثنائية iQBot submitted by emadbably to OptionsInvestopedia [link] [comments]

اقوى كتاب في مجال الخيارات الثنائية

اقوى كتاب في مجال الخيارات الثنائية submitted by asrclub to u/asrclub [link] [comments]

Perl pack/unpack/printf Cheat Sheet

submitted by pkrumins to cheats [link] [comments]

Hello World Quiz!

Bueno andaba boludeando por ahí y ví un challenge de identificar el lenguaje viendo como se hace el Hello World, a ver cuántos identifican :D
Hello, World! Lenguaje
let message: string = 'Hello, World!'; console.log(message); TypeScript__________
echo "Hello, World!"; PHP_________________
puts "Hello, World!" Ruby________________
contract helloWorld { function renderHelloWorld () public pure returns (string) { return 'Hello, World!'; } } Solidity____________
fmt.Println("Hello, World!") Golang (Go)_________
println!("Hello, World!"); Rust________________
System.Console.WriteLine("Hello, World!"); C#__________________
print("Hello, World!"); Perl________________ / Python______________ / Swift_______________ / Dart________________
cout << "Hello, World!"; C++_________________
disp('Hello, World!'); Matlab______________
println("Hello, World!") Julia_______________ / Kotlin______________ / Scala_______________
console.log('Hello, World!'); JavaScript__________
cat('Hello, World!') R___________________
printf("Hello, World!"); C___________________
System.out.println("Hello, World!"); Java________________
Los ejemplos los saque de acá: https://www.makeuseof.com/print-hello-world-top-programming-languages/
[edit] Le agregué padding para no sacarlo por el largo de la palabra :P
submitted by Samus_ to CharruaDevs [link] [comments]

How does one send new commands to run to an already running nohup process or run two commands together/concurrently in nohup?

https://unix.stackexchange.com/questions/724902/how-does-one-send-new-commands-to-run-to-an-already-running-nohup-process-or-run
I want to run a nohup job and to that already running process run a specific new command (e.g. kerberos authentication). In fact the ideal solution would be to first run the reauth command and then the real job **all under the same nohup process id**. *So that the nohup processes never loses the kerberos ticket.* So I want to run reauth synchornously to another python script so that neither lose their kerberos ticket -- **without screen or tmux** or anything that requires me to interact with the script. I basically want to implement a daemon running a python job (or any) that never loses it's ticket until it's done running. How does one do that?

This is my current attempt but I can't quite tell if it's working
```
# - set up this main sh script
source ~/.bashrc
source ~/.bash_profile
source ~/.bashrc.user
echo HOME = $HOME

source cuda11.1

conda init bash
conda activate metalearning_gpu

# - get a job id for this tmux session
export SLURM_JOBID=$(python -c "import random;print(random.randint(0, 1_000_000))")
echo SLURM_JOBID = $SLURM_JOBID
export OUT_FILE=$PWD/main.sh.o$SLURM_JOBID
export ERR_FILE=$PWD/main.sh.e$SLURM_JOBID
export WANDB_DIR=$HOME/wandb_dir

export CUDA_VISIBLE_DEVICES=4
echo CUDA_VISIBLE_DEVICES = $CUDA_VISIBLE_DEVICES
python -c "import torch; print(torch.cuda.get_device_name(0));"

# - CAREFUL, if a job is already running it could do damage to it, rm reauth process, qian doesn't do it so skip it
# top -u brando9
# pkill -9 reauth -u brando9

# - expt python script then inside that python pid attach a reauth process
# should I run rauth within python with subprocess or package both the nohup command and the rauth together in badsh somehow
#python -u ~/diversity-for-predictive-success-of-meta-learning/div_src/diversity_src/experiment_mains/main_sl_with_ddp.py --manual_loads_name sl_hdb1_5cnn_adam_cl_filter_size --filter_size 4 > $OUT_FILE 2> $ERR_FILE &
#nohup (echo $SU_PASSWORD | /afs/cs/software/bin/reauth; python -u ~/diversity-for-predictive-success-of-meta-learning/div_src/diversity_src/experiment_mains/main_sl_with_ddp.py --manual_loads_name sl_hdb1_5cnn_adam_cl_filter_size --filter_size 4 > $OUT_FILE 2> $ERR_FILE) &
nohup (echo $SU_PASSWORD | /afs/cs/software/bin/reauth; python -u ~/main.py > $OUT_FILE 2> $ERR_FILE) &
# other option is to run `echo $SU_PASSWORD | /afs/cs/software/bin/reauth` inside of python, right?
export JOB_PID=$!
echo JOB_PID = $JOB_PID

# - Done
echo "Done with the dispatching (daemon) sh script
```
likely because it's not ran for long enough? Not sure.

I think another alternative would be to run the reauth inside of the python script itself. Not tested it but might work? The main trick is to not like my process with nohup die due to losing the kerberos ticket.

The contents of reauth is:
```
(metalearning_gpu)~ $ cat /afs/cs/software/bin/reauth
#!/usbin/perl
# $Id: reauth 2737 2011-06-20 18:14:05Z miles $
#
# Original version (C) Martin Schulz, 2'2002
# University Karlsruhe
#
# Modifications by Miles Davis <[[email protected]](mailto:[email protected])>
# Super minimal -- call programs rather than functions to reduce dependence
# on extra perl modules.
#
# Heimdal patches thanks to Georgios Asimenos <[[email protected]](mailto:[email protected])>
#

# General:
##########

# This little script aims at maintaining a valid AFS token from a
# users password for long running jobs.

# As everybody knows (or should know) Kerberos tickets and AFS tokens
# only have a limited lifetime. This is so by design and is usually
# reasonable. After 12 hours, it is no more obvious that it is really
# that user sitting in front of the computer that once typed the
# correct password in. Furthermore the damage caused by compromized
# AFS tokens is limited to the lifetime of that ticket.

# However, there are situations when users want to use long running
# jobs that will write to AFS filespace for several days. Renewable
# tickets are not so much of help here, since they can only be renewed
# if ....

# Therefore the secret has somehow deposited on the local computer
# that will run the long time job. This can be eiter done by storing a
# keytab on the local disk, maybe with a cron(*) principal with
# reduces priviledges. The approach taken here is to work with the
# original password and keep it in RAM only.

# When starting this program, the user is asked for his principal and
# the corresponding password. Then the TGT and AFS token is obtained
# and displayed, afterwards, a background process is forked and the
# main process will return to the system prompt. The workload program
# can now be started.

# The background process will periodically attempt to obtain krb
# tickets and AFS tokens. If this fails for some reason (Kerberos
# server not available or anything, the program aborts.

# aklog does not create a new pag if not told so. If you want your
# background process have a separate pag, create it beforehand.

# The reauth.pl program will work until eternity if is not stopped
# somehow. The canonical way is kill it by "kill $pid", where $pid is
# the process id printed before the return of the initial call to
# reauth.pl or found in the output of "ps".


# (*) Cron jobs are another issue. Our institute introduced
# user.cron-style principals to enable cron to obtain a token and then
# work on restricted parts of the users home directories.


# Security issues:
##################

# reauth.pl will run forever if you do not stop it, so don't forget that!

# The password is kept in RAM (of the child process). AFAIK, this can
# only be recovered by local root (who you need to trust anyway). It
# will not survive a reboot of the local machine.

# The password is not kept on any disk. Therefore any bootfloppy
# (reboot to single user mode..) or screwdriver (take disk away..)
# attacks are not promising.

# Be aware that your NSA-, FBI-, MI5-, KGB-, ElQaida-, or (*insert
# your favorite opponent or competitor here*)-sponsored cleaning
# personnel or coworkers might have even more elaborate means... :-)


# BUGS:
#######

# Only mildly tested only on Linux and Solaris.

# Uses kinit, aklog, klist and tokens programs for a KerberosV/ Ken
# Hornstein's migration kit centered AFS setup. Please adjust to your
# config.




###########################################################################
# Configs:


# kinit program, add path if necessary
if ( -e "/uskerberos/bin/kinit" ) {
$kinit="/uskerberos/bin/kinit"; 
} elsif ( -e "/uslib/heimdal/bin/kinit" ) {
$kinit = "/uslib/heimdal/bin/kinit"; 
} elsif ( -e "/usbin/kinit" ) {
$kinit="/usbin/kinit"; 
} else {
die("Couln't find kinit.\\n"); 
}


# aklog program, add path if necessary
if ( -e "/usbin/aklog" ) {
$aklog="/usbin/aklog"; 
} elsif ( -e "/uslib/heimdal/bin/afslog" ) {
\# or, afslog, for heimdal weirdos $aklog="/uslib/heimdal/bin/afslog"; 
} else {
die("Couln't find aklog or afslog.\\n"); 
}

# klist program, add path if necessary
$klist="/uskerberos/bin/klist";

# tokens program, add path if necessary
$tokens="/usbin/tokens";


#################################################################
# Program:

use Getopt::Long;
use POSIX qw(setuid);
use POSIX qw(setgid);
use POSIX qw(setsid);

# Defaults for command line options.
my $keytab = '';
my $command = '';
my $username = '';
my $debug = 0;
my $verbose = 0;
my $interval=15000; # time interval in seconds: 4+ hours:

my %opts = (
\# Keytab 'k=s' => sub { 
$keytab = u/_[1];
$kinit_opts .= "-k -t $keytab ";
},
\# Run command 'c=s' => sub { 
$command = u/_[1];
},
\# Run command as user 'u=s' => sub { 
$username = u/_[1];
},
\# Time interval to sleep 'i=i' => sub { 
$interval = u/_[1];
},
\# Debug 'd' => sub { 
$debug++;
},
\# Be versbose 'v' => sub { 
$verbose++;
},
);


GetOptions(%opts) or die "Usage: reauth [ -k=keytab ] [ -u user ] [ -i ]\n";




if(@ARGV) {
$princ = $ARGV\[0\]; debug\_print(2, "Principal name provided by argument = $princ"); 
} else {
# Assume we want the login name as the principal name
$princ = getpwuid($<); debug\_print(2, "Principal name provided by argument = $princ"); 
}

if ($keytab) {
\# Don't ask for password, a keytab was provided. debug\_print(1, "Keytab provided = $keytab"); 
} else {
\# read password, but turn off echo before: print "Password for $princ: "; system "stty -echo"; $passwd = ; system "stty echo"; printf "\\n"; chomp $passwd; \# Actually get the tickets/tokens if(obtain\_tokens()!=0) { die "Can't obtain kerberos tickets\\n"; } if ($verbose) { show\_tokens(); } 
}

# fork to go into background:
# a) the parent will exit
# b) the child will work on
$pid = fork();
if ($pid) {
\# I am the parent. printf "Background process pid is: $pid\\n"; if ($command) { debug\_print(1,"Waiting for child to die."); wait; debug\_print(1,"Child is dead."); } exit 0; 
} else {
\# I am the child. debug\_print(2,"I am process $$"); print "Can't set session id\\n" unless setsid(); 

debug\_print(2,"KRB5CCNAME: " . $ENV{KRB5CCNAME}); \#if ($ENV{KRB5CCNAME}) { \#$ENV{KRB5CCNAME} = $ENV{KRB5CCNAME} . "\_reauth\_$$"; \#} else { \#$ENV{KRB5CCNAME} = "/tmp/krb5cc\_reauth\_$$"; \#} 

\#debug\_print(2,"Creating " . $ENV{KRB5CCNAME}); \#system "touch $ENV{KRB5CCNAME}"; 


if ($username) { debug\_print(1, "Looking up UID for $username"); ($name,$passwd,$UID,$GID, u/junk) = getpwnam($username); debug\_print(1, "Changing to UID $UID, GID $GID"); print "Can't set group id\\n" unless setgid($GID); print "Can't set user id\\n" unless setuid($UID); if ($ENV{KRB5CCNAME}) { $ENV{KRB5CCNAME} = $ENV{KRB5CCNAME} . "\_reauth\_$$"; } else { $ENV{KRB5CCNAME} = "/tmp/krb5cc\_reauth\_$$"; } } 

debug\_print(2, "Running as uid " . $<); \# Actually get the tickets/tokens if(obtain\_tokens()!=0) { die "Can't obtain kerberos tickets\\n"; } 

if ($verbose) { show\_tokens(); } 

\# If I was told to run a command, do it. if ($command) { debug\_print(1,"About to exec $command"); exec($command) or die "Can't execute '$command'.\\n"; exit } 

debug\_print(2,"Going into auth loop (interval is $interval)."); 

\#close(STDOUT); \#close(STDERR); 

\# Otherwise, work until killed: while (1) { debug\_print(2,"Waking up to obtain new tokens."); obtain\_tokens(); if ($verbose) { show\_tokens(); } sleep $interval; }; 
}

#################################################################


sub obtain_tokens() {

# ignore sigpipes' (according to perlopentut)
$SIG{PIPE} = 'IGNORE';

\#debug\_print(1,"Running: | $kinit -f $kinit\_opts -p $princ 1>/dev/null 2>&1"); 

# run kinit
open(KINIT, "| $kinit -f $kinit_opts -p $princ 1>/dev/null 2>&1");

# pass password to stdin, password does not show up on command line
if (! $keytab) {
 print(KINIT "${passwd}\\n"); 
}

# close pipe and get status
close(KINIT); $status=$?;

debug\_print(1,"kinit exited with status $status\\n"); 
# act on status..
if($status == 256) {
 if ($verbose) { print "WARNING: kinit is not able to obtain Kerberos ticket ($status).\\n"; print " Possible DNS or network problem. Continuing anyway...\\n"; } return 1; 
} elsif($status!=0) {
print "kinit is not able to obtain Kerberos ticket: $status\n";
 return 2; 
};

debug\_print(1,"Running $aklog...\\n"); 
$status = system "$aklog >/dev/null" ;
debug\_print(1,"aklog exited with status $status\\n"); 
if($status!=0) {
print "aklog is not able to obtain AFS token: $status\n";
 return 3; 
};

return 0;

};

##################################################################

sub show_tokens() {
system $klist ; system $tokens ; 
};

##################################################################

sub debug_print($$) {
my $level = shift; my $message = shift; 

if ($debug >= $level) { print "DEBUG$debug: $message\\n"; } 
}

##################################################################
```

----

related:
- reddit cross: https://www.reddit.com/unix/comments/yvn5t3/how_does_one_send_new_commands_to_run_to_an/
- quora cross: https://www.quora.com/unanswered/How-does-one-send-new-commands-to-run-to-an-already-running-nohup-process-or-run-two-commands-together-concurrently-in-nohup
submitted by brandojazz to linuxquestions [link] [comments]

Confusing behaviour of built-in printf %c

I'm getting what I think is a weird result here:
$ printf '%c\n' 65 6 $ 
According to my knowledge of printf(3) format specifiers and having checked the Bash Builtins of the bash manual, the argument should be treated as an int, and that should be outputting A rather than 6, shouldn't it?
Can anyone explain why it's not doing that? Or highlight a bit of documentation that I've missed? Note that the coreutils implementation of printf(1) does the same thing, so I assume it's intentional - only there isn't a coreutils to ask about that one. Also, anyone know the easiest way to convert an ascii code to a character in bash given that printf apparently won't?
submitted by Kare11en to bash [link] [comments]

كسسوارات الهواتف الذكية تستحق ثمنها عصا «سيلفي» وشواحن محمولة وسماعات لاسلكية متقدمة

إكسسوارات الهواتف الذكية تستحق ثمنها

عصا «سيلفي» وشواحن محمولة وسماعات لاسلكية متقدمة الثلاثاء - 6 ذو الحجة 1438 هـ - 29 أغسطس 2017 مـ رقم العدد [ 14154] 📷 شاحن محمول - عدسة إضافية للهاتف لندن: «الشرق الأوسط»
عندما تشتري لنفسك هاتفاً ذكياً جديداً، كيف يمكنك أن تستفيد من أفضل الميزات التي يقدمها؟ عليك بالإكسسوارات، كما يقول بعض الخبراء. لكل هاتف يمكن للمستخدم أن يشتريه، كثير من الأدوات المضافة التي تحسن الأداء وتتميز عن الإكسسوارات الأخرى؛ ابتداء من تحديثات سماعات الأذنين، ومكبرات بلوتوث للصوت لتعزيز صوت الموسيقى، وانتهاء بالأغطية التي تحمي الهاتف من الأضرار. ولكن يجب أن تحرص أن تكون تلك الإضافات الأحدث، خصوصا أن الخيارات المتاحة كثيرة. وهنا بعض النصائح من موقع «انغادجيت» التقني البريطاني التي ستساعد المستخدم في اختيار إكسسوارات الهواتف الذكية التي تستحق الإنفاق عليها. -- إضافات التصوير - إضافات السيلفي: تزداد شعبية الصور الذاتية (السيلفي) وصور البورتريه الشخصية أكثر فأكثر، مما حثّ مصنعي الهواتف الذكية على التركيز أكثر على الكاميرات الأمامية، وكانت آخرها كاميرا «هواوي بي10» التي تقدم للعالم أول عدسة «ليكا» للسيلفي في هاتف ذكي. في حال كان المستخدم يملك عصاً للسيلفي، فيجب أن يجرب أداة «ألترا برايت سيلفي لايت»، (27 دولارا)، Ultra Bright Selfie Light، التي تثبت على أي هاتف ذكي (لها 36 من الصمامات الثنائية الضوئية LED) لتوفير إضاءة أفضل، وإشعاع أفضل لتوفير الوضوح الأكبر للصورة. - عدسات الكاميرا: في حين توفر هواتف متقدمة مثل «سوني إكس زي بريميوم» و«آيفون7» عدسات كاميرا فعالة، لمحبي التصوير الذين يرغبون في الارتقاء بصورهم دون شراء كاميرا باهظة الثمن، فإن بمقدورهم أن يستعينوا بعدسة إضافية. وتوفر عدسة «أولوكليب كور لينس»، (132 دولارا)، Olloclip Core Lens Set، لهاتف «آيفون7». و«آيفون7 بلاس»، من بينها عين السمكة، والزاوية الواسعة، والعدسات المكبرة في قطعة صغيرة تلتصق فوق كاميرا الجهاز. يذكر أن أصحاب هواتف «آندرويد» و«آيفون» يمكنهم أن يستفيدوا من نسخ مخصصة لهواتفهم. - طابعة الصور: بعد التقاط أجمل الصور، قد يرغب المستخدم في تحويلها إلى صورة عادية للذكرى، بدل تركها منسية في ألبوم الكاميرا أو ألبومات «فيسبوك». هنا يمكنه أن يستفيد من طابعة الجيب التي تأتي بحجم صغير لحملها باليد، بحجم هاتف ذكي تقريباً. من بين هذه الطابعات «إتش بي سبروكيت فوتو برينتر»، (132 دولارا)، التي تتصل بهواتف«آيفون» و«آندرويد»عبر بلوتوث ويمكن أن تستخدم لإنتاج صور بحجم 2×3 بوصة. -- أغطية وشواحن - أغطية فخمة: كثيرة هي الإكسسوارات التي يختارها المستخدم، إلا أن غطاء الهاتف لا بد أن يكون أولها. وتكثر الخيارات المتاحة من هذه الإكسسوارات؛ من تلك المضادة للمياه، إلى البلاستيكية الشفافة منها. ولكن في حال كان مالك الهاتف يرغب في خيار أكثر فخامة، فيمكنه أن يختار من مجموعة «باستيل»، Pastel Collection، أو تلك المصنوعة من جلد النوبوك من «سنيكهيف»، (28 دولارا)، التي تقدم له ملمسا راقياً دون أن يدفع مبالغ طائلة. هناك أيضاً الأغطية التي تأتي على شكل محفظة تتضمن جيوبا خاصة للبطاقات البنكية، وطبقة قابلة للطي، وهي متوفرة لـ«آيفون» و«آندرويد» بخيارات كثيرة. - شاحن محمول: مع إمضاء الناس مزيدا من الوقت في استخدام هواتفهم، من تحديث «إنستغرام» إلى مشاهدة مسلسلهم المفضل عبر «نيتفلكس»، لا بد أن البطارية لن تخدمهم طويلاً. لهذا السبب، يُنصح المستخدمون بالاستعانة بشاحن محمول. يوفر «إس تي كاي فاست فيول 15كي»، (66 دولارا)، STK Fast Fuel 15K، شحنة هائلة تصل إلى 15 ألف ملي أمبير في الساعة، التي تصلح لشحن الهاتف 6 مرات متتالية. كما تدعي «باكينغ كوالكوم كويك تشارج»، Packing Qualcomm Quick Charge، للتكنولوجيا أنها قادرة على شحن الهواتف الذكية 4 مرات أسرع ممن الشواحن التقليدية. -- سماعات ومكبرات - سماعات الرأس: يأتي كثير من الهواتف الذكية الحديثة والغالية مع سماعات الأذنين الخاصة بها. ولكن في حال كان المستخدم من محبي الموسيقى العالية، فلا بد من أنه سيبحث عن إكسسوار أكثر حداثة. هناك كثير من الخيارات المتوفرة التي تناسب محبي الرياضة بسبب مقاومتها التعرق وقدرتها على عزل الأصوات المحيطة خلال الجري أو في وسائل النقل المشتركة. توفر سماعة «أوديو تكنيكا»، (105 دولارات)،ATH - CKR70iS، نوعية ممتازة للصوت وبسعر معقول. تمتاز هذه السماعة بمسرعات ديناميكية رائعة للصوت، وبميكروفون صغير يتضمن أزرارا لاستقبال وإنهاء الاتصال والتحكم بالموسيقى. - مكبرات الصوت: حتى لو كانت مكبرات الصوت الموجودة في الهاتف جيدة، فإنه مكن للمستخدم أن يقدم لها دعماً، خصوصا في حال كان يحب مشاركة الموسيقى مع أصدقائه. الخيارات الأقوى متوفرة دائماً لإعدادات أكبر كالحفلات. وفي حين أن مكبرا صغيرا للجيب يمكن أن يفي بالغرض، فإن المكبرات الدائرية الصلبة تظلّ دائماً الخيار الأفضل. يتميز مكبر «جي بي إل فليب 4»، (158)، JBL Flip 4، العامل بتقنية بلوتوث، بحجم صغير قابل للحمل، ولكنه يخبئ ميزات صوتية هائلة، بالإضافة إلى 12 ساعة من الخدمة، والأفضل أنه مضاد للماء، مما يجعله مثالياً للحمل إلى جانب حمام السباحة.
اذاكنت تريد باسعار غير قابله للمنافسة سوف تجدها هنا
أضغط هنا
submitted by Familiar-Interview89 to u/Familiar-Interview89 [link] [comments]

Two questions: (1) How do I enclose filenames with double quotes? (2) How do I remove them from filenames?

Hi,
My operating system is Debian 11.
Note: I do not wish to use the rename command for reason of portability. I understand that the rename command works differently in ArchLinux.
(1) I have a collection of some 30 files with names such as:
Belgium, Brussels E1.txt Bulgaria, Sofia E1.txt Canada, Toronto E3.txt Finland, Helsinki E4.txt etc. 
I wish to enclose the filenames with double quotes, that is:
"Belgium, Brussels E1.txt" "Bulgaria, Sofia E1.txt" "Canada, Toronto E3.txt" "Finland, Helsinki E4.txt" etc. 
My attempt is:
ls -1 | sed 's/.*/ & \\/' 
The output of the above command is not what I want.
(2) How do I reverse the above action? That is, from:
"Belgium, Brussels E1.txt" "Bulgaria, Sofia E1.txt" "Canada, Toronto E3.txt" "Finland, Helsinki E4.txt" etc. 
back to:
Belgium, Brussels E1.txt Bulgaria, Sofia E1.txt Canada, Toronto E3.txt Finland, Helsinki E4.txt etc. 
I tried the following command:
for file in *.txt ; do echo ${file}|sed -e "s/ /./g" -e "s/[\[{\\']//g" ; done 
However, the output is not what I want.
Could somebody help me please? Thanks.
submitted by Vaness20 to bash [link] [comments]

Strange hex colors where 0000803F = 1.0, what converter do i use? Hex to RGB?

So Im modding a game and normally hex colors are 8 digets. like white would be FFFFFFFF, for 255 for all values.
But I came across a segment where color is coded in a way where the values go less than 1 but arnt black.
For example 00000000 0000803F 0000803F 0000803F (B= 0) (G=1.0) (R=1.0) (A=1.0)
Im trying to get the number codes for this (purple color) (R=0.2, G=0.1, B=1.5, A=1)
I know 1 = 0000803F, so I can put that for A but the others, I have no idea, and I cant find a converter online, anyone know what this is called or where I could go to find the numbers I need?
Other codes for reference
Hex = RGB
00 00 80 3F = 1
D9 CE 57 3F = 0.8430
BE 9F 9A 3E = 0.3020
68 91 ED 3C = 0.0290
so the hex code goes in this order D9CE573F BE9F9A3E 6891ED3C 0000803F
and comes out (R=0.0290, G=0.3020, B=0.8430, A=1)
and this color above for example is a glowing yellow color.
the glowing purple color that i am trying to figure out the code for is (R=0.2, G=0.1, B=1.5, A=1)
submitted by swampcrusher to AskProgramming [link] [comments]

Handling null bytes for buffer overflows

Hello,
I am reading the book Hacking: The Are of Explioitation and trying to perfrom a buffer overflow.
The command that is used [email protected]:~/booksrc $ ./auth_overflow2 $(perl -e 'print "\xbf\x84\x04\x08"x10')
But on my machine I have a null byte (\x00\x00\x07\xe1) therefore it does not handle well this and ommits my null bytes. I tried using piping , even trying to play with the source code of shell but it does not work .. do you might have any ideas how can I overcome this issue?

When doing printf "\xe1\x07\x00\x00: | hd I am managing to piping the null byte.. (without command substitution I am managing to piping the null bytes.. thinking somehow to use this way.
Edited: It also works when writing into file, I do see the null bytes when ding: hd < args
But the stdin is not redirected :(
When dping ./myExe < args it still sees < as an argument (so doing certain manipulations with gdb that I saw on the internet i.e https://stackoverflow.com/questions/2953658/gdb-trouble-with-stdin-redirection?fbclid=IwAR16ic5ia0811JN18Dp0Aex7juTkT_KuX_g9A0huhwzZsdE4__myUJm5sUI)
submitted by MrsSergeivna to ExploitDev [link] [comments]

Know your System Administrator. A Field Guide

Know your System Administrator

A Field Guide

by Stephan Zielinski
There are four major species of Unix sysad:
  1. The Technical thug — Usually a systems programmer who has been forced into system administration; writes scripts in a polyglot of the Bourne shell, sed, C, awk, Perl, and APL.
  2. The Administrative fascist — Usually a retentive drone (or rarely, a harridan ex-secretary) who has been forced into system administration.
  3. The Maniac — Usually an aging cracker who discovered that neither the Mossad nor Cuba are willing to pay a living wage for computer espionage. Fell into system administration; occasionally approaches major competitors with indesp schemes.
  4. The Idiot — Usually a cretin, or old COBOL programmer selected to be the system administrator by a committee of cretins, and old COBOL programmers.

How to Identify Your System Administrator

SITUATION: Low disk space
SITUATION: Excessive CPU usage
SITUATION: New account creation
SITUATION: Root disk fails
SITUATION: Poor network response
SITUATION: User questions
SITUATION: Stupid user questions
SITUATION: Process accounting management
SITUATION: Religious war, BSD vs. System V
SITUATION: Religious war, System V vs. AIX
SITUATION: Balky printer daemons
SITUATION: OS upgrade
SITUATION: Balky mail
SITUATION: Users want phone list application

Other Guidelines

Typical root .cshrc file
Hobbies, technical
Hobbies, nontechnical
1992 Presidential Election
1996 Presidential Election
Compound System Administrators
submitted by SnooPoems8743 to teenagers [link] [comments]

Regex Help

Regex Help
Hey yall,
I am resorting to Reddit in the hopes someone out there can help me out with a part of an assignment im stuck on. Basically, I am reading in input from the diamond operator which then I need to split the input into words, however, its a specific pattern that I cant seem to figure out. Each word should consist of two or more characters, start with a letter, and then the remaining characters can consist of letters, digits, or underscores. I am using the split() function to get the words but I can't quite get the correct pattern that I need. Some guidance here would be appreciated. This is the closest that ive gotten but its not quite it.

https://preview.redd.it/9cpiebwszup81.png?width=457&format=png&auto=webp&s=eaf26ce491c84bb2ab3d09800c6486f2feaf92ad
Also, once I print out each word I need to print on which lines of the input you can find that word. Getting the line number is quite easy but I am not sure how to keep track of it other than a 2d array. Any advice or ideas would also be appreciated.
If this is not the place to post these kind of posts let me know I will take it down or feel free to take it down.
Edit:
The code for the people that want to see the whole program:
#!/usbin/perl -w use strict; my @input; my $j = 0; my %words; my $lineNum = 0; while(<>) { $lineNum++; for my $word (split /[!\ @".;\#$%^&*()=?<>\/\-']/) #" { $word =~ s/^\s+|\s+$//g; $input[$j++] = $word; $words{lc($word)}++; } } my $max = 0; foreach my $str (@input) { if(length($str) > $max) { $max = length($str); } } foreach my $str (sort keys %words) { printf "%*s: %4s times, lines: 1\n", $max, $str, $words{$str}; } exit 0;
submitted by ItsthatguyIan to perl [link] [comments]

How to stop auto-generated URL on the website?

I facing a serious problem on the website I found a lot of URLs that are not created from my end, but those are created and indexed by Webbots and visible on SERP. website endtrace . com
I found almost 2000+ URLs which are not in the part of my website
find few URLs from below
https://www.endtrace.com/تداول-الخيارات-الثنائية-حلال-ام-حرام
https://www.endtrace.com/korvo-binary-options-indicator-review
https://www.endtrace.com/binary-options-trading
Also wanted to let you know that show 404 Page not found error while open Kindly help me with this
submitted by ramDGtalmarktng to bigseo [link] [comments]

calculations on the command line

Hi,
sometimes I need to do simple calculations and on the command line I usually do that with bc.
But now I wanted to calculate the number of days remaining in the year.
So "date +%j" gives me the current day number - I need to subtract this from 365.
Now I could store the output of the date command in a shell variable - but bc does not seem to be able to access shell variables - or I could try to call date from within bc, but that does not seem to be possible as well.
So how do I do that in an elegant way: To call some utility that returns a number and then do some calulcations with it.
Is there a better way then simply doing something like
perl -e 'print 365 - `date +%j`'
Many thanks.
submitted by ghiste to linuxquestions [link] [comments]

Creating a shared C library out of go project to be loaded dynamically by other applications (C/Perl/...) on AIX 7.2

EDIT: For any poor soul that finds this, in search of a solution for the shared library from go conundrum: I was unable to find a solution that uses go and I would suggest, that until google go provides native c-shared support for AIX you should find an alternative for your project.
I did not go forward with gccgo because that felt like an entirely different can of worms that I was unwilling to delve further into. FWIW I myself am going forward switching to pure C implementation, because there I at least have a (somewhat) firm(er) understanding of it all.
Should anyone find a solution I'd love to hear from you and see how you got around this limitation.
Hello everyone,
Just joined, new here and frankly I'm not entirely sure if this sub is even the right place for the question. Found it through go's github page so I thought I'd start here.
Should this not be the right place, and is better fit to be a Stackoverflow Question/any other place, dear mods, feel free to delete it.
As the title says I'm trying to realise a rather... fringe setup. I want to create a shared library out of a go project so that it can be used by other applications written in Perl/C/etc... on an IBM AIX 7.2 running on some powerpc hardware.
However I am currently stuck on an issue that I'm unclear how to fix and would appreciate any help.
I am aware that golang itself does currently not support the -buildmode=c-shared on AIX(source1, source2) but I came up with the workaround of creating a static archive with -buildmode=c-archive, add that output to a dynamic lib using gcc and have that resulting .so/.a file (AIX expects every lib, static or shared to end on .a) be used by the other applications.
So far I have created the following little go library and main.c setup to test my idea.
My sharedLibTest.go
``` package main
import ( "fmt" )
import "C"
func main() { fmt.Printf("%s\n", "Golang: main was called") MyPackage_Init() MyPackage_Create() }
//export MyPackage_Init func MyPackage_Init() { fmt.Printf("%s\n", "Golang: MyPackage_Init was called") }
//export MyPackage_Create func MyPackage_Create() { fmt.Printf("%s\n", "Golang: MyPackage_Create was called") }
```
The corresponding main.c that should call the code in the end ```

include

include "sharedLibTest.h"

int main() { printf("%s\n", "C: main() called"); MyPackage_Init(); MyPackage_Create(); } ```
I am able to compile the above .go code with
go build -v -buildmode=c-archive -mod vendor -o /home/myuseworkspace/go_proj/sharedLibTest/sharedLibTest.a /home/myuseworkspace/go_proj/sharedLibTest/sharedLibTest.go Because of AIX specific weird behaviour I need to prepare a list of symbols that should be exported for the linking
``` $ cat > symbols.export << EOF
MyPackage_Init MyPackage_Create EOF ```
With that I can use gcc to create a shared object out of my static compilation gcc -fPIC -DPIC -g -O2 -mcpu=power7 -maix64 -shared -lpthread -Wl,-bE:symbols.export -o libsharedLibTest.so -Wl,-bnoobjreorder ./sharedLibTest.a
Now, again because of how weird AIX behaves, we need to add the shared object to an archive, as the AIX version of a linker does not look for .so files, but only .a files. ar -X64 rcs libsharedLibTest.a libsharedLibTest.so
Finally I can try to link my main.c against the dynamic library with gcc -L. -g -O2 -mcpu=power7 -maix64 -Wl,-bnoobjreorder -lsharedLibTest -lpthreads main.c That also compiles successfully, however when I try to run my application with
LD_LIBRARY_PATH=/home/myuseworkspace/go_proj/sharedLibTest ./a.out
I get the error $ ./a.out exec(): 0509-036 Cannot load program ./a.out because of the following errors: 0509-150 Dependent module /home/myuseworkspace/go_proj/sharedLibTest/libsharedLibTest.a(libsharedLibTest.so) could not be loaded. 0509-187 The local-exec model was used for thread-local storage, but the module is not the main program. 0509-193 Examine the .loader section header with the 'dump -Hv' command.
Now, so far the only lead I have on this is that the .a file created by the go toolchain is likely to not be compiled as Position Independent Code(PIC) and adding the -fPIC flag to the process would result in a solution. But neither adding it as "export CGO_CFLAGS="-fPIC" nor via -gcflags has made any difference. As far as I can tell, after having tried to examine the exact commands executed during go build with the flags "-a -work -p 1 -x -v" I get the impression that -buildmode=c-archive already passes -fPIC to its compilation steps by default but it has no apparent effect on my above mentioned error.
Creating a pure C shared library on AIX seems to work. I only need to pass -fPIC to the library in question and it results after near identical steps in gcc to run perfectly fine. (I'll omit the c code) gcc -Wall -Werror -g -O2 -mcpu=power7 -maix64 -fPIC -c mysharedthing.c ar -X64 rcs mysharedthing.a mysharedthing.o gcc -Wall -Werror -g -O2 -mcpu=power7 -maix64 -Wl,-bE:symbols.exp -Wl,-bnoobjreorder -shared -o libmysharedthing.so mysharedthing.a cp libmysharedthing.so libmysharedthing.a gcc -Wall -Werror -g -O2 -mcpu=power7 -maix64 -L. -Wall main.c -lmysharedthing LD_LIBRARY_PATH=/home/miecc/workspace/ccpp_proj/pure_shared_lib ./a.out I frankly don't see much of a difference between the golang output and my pure C example ito compilation and as such am running out of ideas what else to change.
Maybe it isn't possible because go simply does not produce PIC code on AIX at all and this is a futile endeavour but I still have hope there is a way to create shared golang libraries.
Anyone any ideas on this?
EDIT: I seem to have forgotten the versions I'm working with. - AIX 7.2 - gcc version 8.3.0 - go version go1.16.12 aix/ppc64
EDIT2: Based on a quick test on my local machine I tried adding another buildflag to the go build invocation: go build -buildmode=c-archive -gcflags=-shared -ldflags=-linkmode=external -mod vendor -o /home/myuseworkspace/go_proj/sharedLibTest/sharedLibTest.a /home/myuseworkspace/go_proj/sharedLibTest/sharedLibTest.go
However this leads to a rather cryptic result that I interpret as assembler or microcode instructions being unsupported on AIX. main.main: unknown reloc to .TOC.: 48 (R_ADDRPOWER_PCREL) _cgoexp_87081e778e87_MyPackage_Init: unknown reloc to .TOC.: 48 (R_ADDRPOWER_PCREL) _cgoexp_87081e778e87_MyPackage_Create: unknown reloc to .TOC.: 48 (R_ADDRPOWER_PCREL) I take it it's the same error that would occur when using -buildmode=c-shared but we are stopped before it actually does anything.
submitted by knmiecc to golang [link] [comments]

How to show AMD GPU Usage in i3blocks

Hello everyone. I use i3blocks as status bar. I am having hard time to show my AMD radeon M330 GPU usage in status bar. It's pretty old gpu but I want to see if it is being used while I am using my pc. I can do with radeon top but I want to see it in the status bar. I tried the given module form github of i3blocks but it didn't show up.
My GPU:
GPU: AMD ATI Radeon HD 8670A/8670M/8690M / R5
My i3blocks.conf
``` [gpu-load] command=$SCRIPT_DIgpu-load/ label=GPU interval=10

min_width=GPU 100% 100% 100% 100%

GPU_BRAND=NVIDIA // or AMD

T_WARN=70

T_CRIT=90

```
This is the gpu-load script. I have set the gpu brand as AMD but still it is not working.
```

!/usbin/env perl

This program is free software: you can redistribute it and/or modify

it under the terms of the GNU General Public License as published by

the Free Software Foundation, either version 3 of the License, or

(at your option) any later version.

This program is distributed in the hope that it will be useful,

but WITHOUT ANY WARRANTY; without even the implied warranty of

MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

GNU General Public License for more details.

You should have received a copy of the GNU General Public License

along with this program. If not, see http://www.gnu.org/licenses/.

use strict; use warnings; use utf8; use Getopt::Long;

default values

my $t_warn = $ENV{T_WARN} || 70; my $t_crit = $ENV{T_CRIT} || 90; my $gpu_brand = "AMD"; my $gpu_usage = -1; my $gpu_mem = -1; my $gpu_video = -1; my $gpu_pcie = -1;
my $full_text = "";
sub help { print "Usage: gpu-load [-w ] [-c ]\n"; print "-w : warning threshold to become amber\n"; print "-c : critical threshold to become red\n"; exit 0; }
GetOptions("help|h" => &help, "w=i" => \$t_warn, "c=i" => \$t_crit);

Get GPU usage from nvidia-settings

if ($gpu_brand eq "NVIDIA") { open (NVS, 'nvidia-settings -q GPUUtilization -t |') or die; while () { if (/[a-zA-Z]*=(\d+), [a-zA-Z]=(\d+), [a-zA-Z]=(\d+), [a-zA-Z]*=(\d+)$/) { $gpu_usage = $1; $gpu_mem = $2; $gpu_video = $3; $gpu_pcie = $4; last; } } close(NVS); $full_text = sprintf "%.0f%% %.0f%% %.0f%% %.0f%%\n", $gpu_usage, $gpu_mem, $gpu_video, $gpu_pcie; }

For AMD, get from radeontop

elsif ($gpu_brand eq "AMD") { open (AMD, 'radeontop -d - -l 1 |') or die; while () { if (/.*[gpu] (\d+).\d+%..[vram] (\d+).\d+%.*$/) { $gpu_usage = $1; $gpu_mem = $2; last; } } close(AMD); $full_text = sprintf "%.0f%% %.0f%%\n", $gpu_usage, $gpu_mem; }
$gpu_usage eq -1 and die 'Can\'t find GPU information';

Print full_text, short_text

print $full_text; printf "%.0f%%\n", $gpu_usage;

Print color, if needed

if ($gpu_usage >= $t_crit || $gpu_mem >= $t_crit || $gpu_video >= $t_crit || $gpu_pcie >= $t_crit) { print "#FF0000\n"; exit 33; } elsif ($gpu_usage >= $t_warn || $gpu_mem >= $t_warn || $gpu_video >= $t_warn || $gpu_pcie >= $t_warn) { print "#FFBF00\n"; }
exit 0; ```
submitted by Holiday-Split8220 to i3wm [link] [comments]

Help me get rid of these -> 🧤

I have a post title which looks like this:
Vêtements d’hiver 🧤
I'd like to get rid of the clapping emoji (and any other attached emojis), but keep everything else.
I've been using this, but for some reason it turns the apostrophe into a numerical code:
$stripped_title = preg_replace("/[^\p{L}0-9\s()@_'&-]+/u", '', get_the_title( $post_object ) ); 
So I'm close, but just not quite there yet! Where am I going wrong?
submitted by rousseaux to regex [link] [comments]

AWK fixed width columns and non-western characters

Hi everyone. So, I have been scratching my head for sometime, little by little I'm creating this little tool to search my browser history, oftentimes with the help of you guys, thank you very much again, and I have this little command which is intend to adjust the column, so that they all have and a given fixed width.
Like, limit the A column to X amount of characters, limit the B column to Y amount of characters and limiting column C to a Z amount of characters (the other columns I don't want to be affected, because I will hide them later when piping the result to FZF, using ghost columns). It works, more or less, although when dealing with non-western characters, like chinese or something, the adjustment gets all screwed up, like this for instance:
https://i.imgur.com/1ikZBoa.png
My guess is AWK is having trouble cutting non-western columns on the first column, so they end up not getting limited. Any suggestion on how do deal on that?
cat data.xml | awk -F'\t' '{printf "%-65s\t%-65s\t%-10s\t%-10s\t%-10s\t%-100s\t%-100s\t\n" ,(length($1)>60)?substr($1,0,50)"...":$1, (length($2)>60)?substr($2,0,58)"...":$2, (length($3)>1)?substr($3,0,20)" ":$3, (length($14)>1)?substr($14,0,20)" ":$4, $5, $1, $2} '| fzf 
As always, thank you very much.
submitted by eric1707 to bash [link] [comments]

Shell benchmarks comparing sh, bash, and ksh

I used https://github.com/shellspec/shellbench to compare the shells I use most often. I don't generally write shell scripts longer than 50-100 lines -- at that point I'd use python or perl or what-have-you -- but when scripts are run frequently, the time can add up.
My system is FreeBSD 11.3-RELEASE amd64, Xeon E-2124 CPU @ 3.30GHz.
/bin/sh is the Almquist shell. me% ksh --version version sh (AT&T Research) 93u+ 2012-08-01 me% bash --version GNU bash, version 5.0.3(0)-release (amd64-portbld-freebsd11.2) 
In all of the tests below, the count = number of executions per second for three seconds after a one-second warmup. KSH beat bash in nearly every test, sometimes quite significantly.
me% ./shellbench -s sh,bash,ksh -c sample/assign.sh --------------------------------------------------------------- name sh bash ksh --------------------------------------------------------------- [null loop] 970,233 403,326 614,986 assign.sh: positional params 3,212,104 533,680 2,320,475 assign.sh: variable 4,399,471 1,315,650 6,356,457 assign.sh: local var 4,407,139 1,349,358 error assign.sh: local var (typeset) error 1,244,267 3,096,062 --------------------------------------------------------------- me% ./shellbench -s sh,bash,ksh -c sample/cmp.sh --------------------------------------------------------------- name sh bash ksh --------------------------------------------------------------- [null loop] 974,446 405,296 615,435 cmp.sh: [ ] 2,122,266 368,651 4,659,189 cmp.sh: [[ ]] error 636,511 29,285,902 cmp.sh: case 4,091,252 1,116,886 38,211,857 --------------------------------------------------------------- me% ./shellbench -s sh,bash,ksh -c sample/count.sh --------------------------------------------------------------- name sh bash ksh --------------------------------------------------------------- [null loop] 966,575 404,708 618,038 count.sh: posix 1,433,782 662,993 942,077 count.sh: typeset -i error 613,535 918,969 count.sh: increment error 845,290 3,863,558 --------------------------------------------------------------- me% ./shellbench -s sh,bash,ksh -c sample/eval.sh --------------------------------------------------------------- name sh bash ksh --------------------------------------------------------------- [null loop] 974,158 412,523 628,518 eval.sh: direct assign 1,761,935 282,393 658,831 eval.sh: eval assign 932,933 118,282 315,872 eval.sh: command subs 5,764 2,753 114,871 --------------------------------------------------------------- me% ./shellbench -s sh,bash,ksh -c sample/func.sh --------------------------------------------------------------- name sh bash ksh --------------------------------------------------------------- [null loop] 966,125 404,461 616,734 func.sh: no func 6,317,337 1,140,825 5,808,822 func.sh: func 2,909,820 319,780 854,618 --------------------------------------------------------------- me% ./shellbench -s sh,bash,ksh -c sample/null.sh --------------------------------------------------------------- name sh bash ksh --------------------------------------------------------------- [null loop] 966,857 404,676 615,303 null.sh: assign variable 4,320,214 1,679,428 5,498,903 null.sh: define function 10,014,013 1,793,510 5,558,627 null.sh: undefined variable 6,205,140 690,323 3,648,905 null.sh: : command 6,663,393 1,140,983 5,931,546 --------------------------------------------------------------- me% ./shellbench -s sh,bash,ksh -c sample/output.sh --------------------------------------------------------------- name sh bash ksh --------------------------------------------------------------- [null loop] 966,213 406,563 616,224 output.sh: echo 1,619,911 477,538 2,492,384 output.sh: printf 1,597,145 500,865 601,209 output.sh: print error error 1,024,328 --------------------------------------------------------------- me% ./shellbench -s sh,bash,ksh -c sample/subshell.sh --------------------------------------------------------------- name sh bash ksh --------------------------------------------------------------- [null loop] 965,811 390,643 613,184 subshell.sh: no subshell 5,351,171 1,053,726 6,475,971 subshell.sh: brace 5,345,017 1,023,909 5,962,792 subshell.sh: subshell 6,622 3,061 300,260 subshell.sh: command subs 1,951,503 2,784 179,446 subshell.sh: external command 2,307 1,602 2,232 --------------------------------------------------------------- 
submitted by vogelke to commandline [link] [comments]

[st] my custom "clippaste" function freezes the terminal

The purpose is to escape the clipboard's content first, and then paste it.
This is my custom function:
void paste_esc () { FILE * clip_escaped = popen ("xclip -o -selection clipboard | "ESCAPER, "r"); if (clip_escaped == NULL) return; char buff [256]; size_t buffsize; while (buffsize = fread (buff, 1, 255, clip_escaped)) ttywrite (buff, buffsize, 0); pclose (clip_escaped); } 
I've also tried xsel, sselp.. and printf %q (/bin/printf) for escaping.
ESCAPER is the inline version of this script:
#!/usbin/env perl while () { s/([!#\$%&\*\(\) ='"\\\|\[\]`~,<>\?])/\\\1/g; print stdout $_; } 
I debug this function:
https://preview.redd.it/ycngbqo2z8n81.png?width=1920&format=png&auto=webp&s=3a7eadd33a988a031290a2329b5b992a850a0f95
And it comes out that terminal freezes after pclose.

When the terminal freezes, I have these in ps xf:
 xsel --logfile /dev/null -i --primary xsel --logfile /dev/null -i --clipboard 
I also have clipmenud running in the background.
What's wrong? How to fix this bug?
submitted by GasparVardanyan to suckless [link] [comments]

اروع كتاب عن الهكر 400 صفحة عربي [od4pzm3m5wnp]. ... الخيارات المتاحة إليك تتضمن نشر المحتوى على أكثر من موقع في آنٍ واحد، والسماح للمستخدمين بمتابعة (follow) بعضهم بعضًا، والمزيد… سأشرح هذه النقطة بالتفصيل في هذه الدورة. إنشاء المواقع. تُمكِّنك ميزة تعدد المواقع من ...

[index] [9247] [8737] [5869] [12440] [9599] [4387] [13833] [12102] [8393] [13916]

#

test2