Watch environment variable in C - environment-variables

How can I watch an environment variable for changes in C? Judging by the GLIbc manual, I don't think there's a standard way to do this, but I just want to be sure. I'm looking for something like this:
void watchenv(char *varname, void(callback*)());

Related

Does erlang-ls support go-to-definition for variables?

Does erlang-ls support go-to-definition for variables?
Going to definition seems to work for functions and modules, but Coc.vim says "provider not found" when I gd on a variable name. Cmd-clicking a variable name doesn't do anything in VSCode, either.
What I tried:
erlang-ls docs and issues
Peeking through the source, I see that els_code_navigation matches on poi_kind. The relevant poi_kind would be variable, but "variable" doesn't appear in els_code_navigation.
There is currently no support in erlang_ls for jumping to the definition of a variable.
If this is something that you would like implemented please open a feature request in the erlang_ls GitHub project.

How to deobfuscate this?

I obfuscated this script using some site
But i'm wondering how to deobfuscate it? can someone help me?
i tried using most decompilers and a lot of ways but none has worked
local howtoDEOBFUSCATEthis_Illll='2d2d341be85c64062f4287f90df25edffd08ec003b5d9491e1db542a356f64a488a1015c2a6b6d4596f2fa74fd602d30b0ecb05f4d768cd9b54d8463b39729eb1fe84630c0f8983f1a0087681fe4f2b322450ce07b
something like that for an example.
the whole script: https://pastebin.com/raw/fDGKYrH7
First reformat into a sane layout. a newline before every local and end will do a lot. Then indenting the functions that become visible is pretty easy.
After that use search replace to inline constants. For example: local howtoDEOBFUSCATEthis_IlIlIIlIlIlI=8480; means you can replace every howtoDEOBFUSCATEthis_IlIlIIlIlIlI with 8480. Though be careful about assignments to it. If there are any then it's better to rename the variable something sensible.
If an identifier has no match you can delete the statement.
Eventually you get to functions that are actually used.
Looking at the code it seems to be an interpreter implementation. I believe it's a lua interpreter
Which means that you'll need to verify that and decompile what the interpreter executes.

Viewing exported env vars with elixir

I understand how you set an environment variable using elixir.
export AWS_ACCESS_KEY_ID=your_access_key_id
Okay that works, but what if I'm not confident that I typed everything correct and I want to check what the value is? How can I do this with Elixir?
You could leverage the following function: System.get_env/1.

How to use User-Input to address specific variables in Pascal (Eval/Exec?)

I'm trying to do something very specific in the fractal program Apophysis 7X, the scripting language in use is Pascal (the project is written in Delphi).
What I want to do:
Write a script that can dynamically address certain variables. In the program I have so called transforms, and each transform has multiple variations, new variations can be added by plugins, hence I do not know all names there could be.
The variables are addressed like this:
Transform.Linear:=Sin(Pi*(FrameCount / FrameQuantity));
The Variation that is to be changed might not be Linear though, but a dozen other words, like Spherical or Zcone.
If eval would work I'd assume the solution to be something like this:
VariationName:=User-Input;
eval('Transform.' + VariationName + ':=Sin(Pi*(FrameCount / FrameQuantity));')
As far as I know though, there is no such thing like eval or exec in Pascal (Tried: Eval/eval/Exec/exec). Searching other sites and the internet didn't turn up any ideas either.
So the question is how can I use the User-Input to address those variables? Obviously:
Transform.'User-Input':=Sin(Pi*(FrameCount / FrameQuantity));
will not work. Since I don't know all names up front I can't just use an array or anything static either. Any ideas would be greatly welcome.
What you want to do is called Reflection. Delphi does have support for it (they call it Extended RTTI). Give a look at the functions IsPublishedProp and SetPropValue.

Why redefinition standard variables in awesome wm modules needed?

Any awesome wm module starts from redefinition standard variables to local. Something like that
local table = table
local string = string
local tostring = tostring
What does it do? All code still working fine after deleting this lines.
It's purely an optimization thing. Local variables are faster to read/write than global variables. This is in part because globals are hash table lookups (e.g. foo => _G["foo"]) and locals are VM register lookups. So it's not uncommon for modules that are going to be using a global a lot to alias it via a local variable.
For your code, unless you know something is going to be called a ton and is going to be a bottleneck, I wouldn't bother with this technique. Lua isn't C. You're trading performance for brevity and clarity. Don't trade it back until you know you have to.
"What does it do" is already answered.
For "why is it done": Back before awesome supported lua 5.2 (without deprecated functions), all modules used lua's module() function to set themselves up. This meant that values from the global variable became inaccessible and this "local trick" actually was necessary.

Resources