Fish shell not showing branch name - macos

here's my problem
i install fishshell and made some changes in the config and i'm geting question marks instead of branch name..
any hints??
#config.fish
if status is-interactive
set -g theme_svn_prompt_enabled yes
set -g scm_prompt_blacklist "/path/to/blacklist"
set -gx VIRTUAL_ENV_DISABLE_PROMPT 1
end
Thanks in advance.

Related

Can't start SSH Agent with Git Bash on Windows 10

I have executed the following command in Git Bash, and it returns the following error.
$ eval $(ssh-agent -s)
1 [main] ssh-agent 1564 child_info_fork::abort: \??\C:\Program Files\Git\usr\bin\msys-
crypto-1.1.dll: Loaded to different address: parent(0x8A0000) != child(0x910000)
fork: Resource temporarily available
I have also tried restarting my system, that doesn't do any good.
Any Ideas what this issue is all about, or how to fix it, if possible?
Thanks in advance! πŸ˜‰πŸ‘
Make sure first in a CMD session to:
upgrade to the latest Git for Windows
the PATH correctly set to Git, for testing.
That is:
set GH=C:\path\to\git
set PATH=C:\windows\system32;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\
set PATH=%GH%\bin;%GH%\usr\bin;%GH%\mingw64\bin;%GH%\mingw64\libexec\git-core;%PATH%
Then, in that same CMD session, type git bash and try again

LD_PRELOAD not working on Heroku + jemalloc + quotaguard

TL;DR: update your bin/qgtunnel.
I've recently noticed an increase in my web dyno's memory usage. After digging a bit, I could see that the LD_PRELOAD variable that should be set with heroku-buildpack-jemalloc was not set correctly. I used a tiny script (bin/show_preload) that helped me debug that and trace which program was overriding LD_PRELOAD.
#!/usr/bin/env bash
echo "buildpack=foo preload='$LD_PRELOAD' at=start-app cmd='$#'"
$#
I introduced that in our Procfile:
web: bin/show_preload bin/qgtunnel bin/show_preload bin/start-nginx bin/show_preload bin/start-pgbouncer bin/show_preload bundle exec puma -C config/puma.rb
And when lauching on heroku I can see that bin/qgtunnel overrides our LD_PRELOAD configuration.
I created a tiny helper for the time being which makes sure I keep original value as well as what is added by bin/qgtunnel:
#!/usr/bin/env bash
after_qgtunnel_script=$(mktemp)
echo <<-BASH > $after_qgtunnel_script
# Retrieve previous LD_PRELOAD value
export LD_PRELOAD="\$LD_PRELOAD $LD_PRELOAD"
# Clean after usage
rm $after_qgtunnel_script
# Start following commands
$#
BASH
chmod +x $after_qgtunnel_script
bin/qgtunnel $after_qgtunnel_script $#
If you ever need this script use it in place of bin/qgtunnel
After reaching out to Quotaguard, they patched the qgtunnel binary and there is no error anymore:
curl https://quotaguard.s3.amazonaws.com/qgtunnel-2.4.1.tar.gz | tar xz
git add bin/qgtunnel vendor/nss_wrapper/libnss_wrapper.so
git commit -m "Update qgtunnel to fix LD_PRELOAD"
NOTE: new versions may occur since that one, see the related documentation

error while installing go from source

i am trying to install go from source
i follow this steps
git clone https://go.googlesource.com/go
cd go
git checkout go1.6.1
cd src
./all.bash
now it gives me the error saying
##### Building Go bootstrap tool.
cmd/dist
ERROR: Cannot find /root/go1.4/bin/go.
Set $GOROOT_BOOTSTRAP to a working Go tree >= Go 1.4.
any idea how can i fix this do i just need to set env variable or any other installation is needed ?
You need to have an installed Go version 1.4 or newer to build the recent Go releases. The build script defaults to some path but if it's not there you need to set GOROOT_BOOTSTRAP environment variable to point to a previous working Go installation.
Go is written in Go (starting from version 1.5) so you have to install Go1.4 first. Just get Go Version Manager and run:
$ gvm install go1.4
$ gvm use go1.4
$ export GOROOT_BOOTSTRAP=$GOROOT
Another approach is about to install gcc go frontend:
$ sudo apt-get install gccgo-5
$ sudo update-alternatives --set go /usr/bin/go-5
$ export GOROOT_BOOTSTRAP=/usr
If you are not using gvm and are on Linux, your go binary is mostly installed at /usr/local/go/bin/go. You need to set /usr/local/go as your GOROOT_BOOTSTRAP by:
$ export GOROOT_BOOTSTRAP=/usr/local/go
The following won't work if you haven't previously built from source (the version parsing will fail). Unfortunately it also won't work for windows (unless you're in wsl/cygwin/msys et cetera).
If you have the source for an older version you may want to use the following zsh/bash(?) function
# create a backup of a directory by recursively copying its contents into an empty one with a similar name
bckp () {
old=$1
if [[ -z $1 ]]; then
old="../$(basename "$(pwd)")"
fi
new="$old-bckp"
[[ -d $new ]] && echo "already exists" && return 1
cp -rf "$old/" "$new"
}
then do one, or some combination, of the following
if you have unstashed changes you want to commit:
cd $(go env GOROOT) # visit the root directory of your current go installation
bckp # back it up
git stash # keep any changes you've made but do not want to commit in a safe place
git pull # collect remote commits
git stash pop # restore your changes
cd src # go to the golang source files and installation scripts
export GOROOT_BOOTSTRAP=$(go env GOROOT)-bckp # make the environment variable accessible from other shells
chmod +x ./all.bash # set the permissions of the installation/build script so that it can be executed
./all.bash # execute the installation/build script
cd ../bin && sudo ln -f $PWD/go /usr/bin/go # create a globablly accessible link to the new binary, feels like it should be unnecessary but I couldn't use the new binary until I did this
or, if you've already pulled the commits you wish to include and popped your changes:
cd $(go env GOROOT) # visit the root directory of your current go installation
bckp # back it up
cd ../go-bckp # enter the backup directory
git stash # keep any changes you've made but do not want to commit in a safe place
git checkout $(go version | cut -d- -f2 | cut -d" " -f1) # parse version info and restore the old codebase
git stash pop # restore your changes
cd ../go/src # go to the golang source files and installation scripts
export GOROOT_BOOTSTRAP=$(go env GOROOT)-bckp # make the environment variable accessible from other shells
chmod +x ./all.bash # set the permissions of the installation/build script so that it can be executed
./all.bash # execute the installation/build script
cd ../bin && sudo ln -f $PWD/go /usr/bin/go # create a globablly accessible link to the new binary, feels like it should be unnecessary but I couldn't use the new binary until I did this
or if you haven't made any changes:
cd $(go env GOROOT) # visit the root directory of your current go installation
bckp # back it up
cd src # go to the golang source files and installation scripts
export GOROOT_BOOTSTRAP=$(go env GOROOT)-bckp # make the environment variable accessible from other shells
chmod +x ./all.bash # set the permissions of the installation/build script so that it can be executed
./all.bash # execute the installation/build script
cd ../bin && sudo ln -f $PWD/go /usr/bin/go # create a globablly accessible link to the new binary, feels like it should be unnecessary but I couldn't use the new binary until I did this.

How to reload .com.apple.iokit.graphics underscan without restarting?

I'm looking into making a script that automatically turns off underscan when my Plex Home Theater.app is running.
So far I have found the file containing the setting at /var/db/.com.apple.iokit.graphics.
Then I tried changing the underscan value in the settings file with PlistBuddy:
# underscan 100%
sudo /usr/libexec/PlistBuddy /private/var/db/.com.apple.iokit.graphics -c 'Set "IOService\:/AppleACPIPlatformExpert/PCI0#0/AppleACPIPCI/IGPU#2/AppleIntelFramebuffer#2/display0/AppleDisplay-3dcb-e51:pscn" 8800'
# underscan off
sudo /usr/libexec/PlistBuddy /private/var/db/.com.apple.iokit.graphics -c 'Set "IOService\:/AppleACPIPlatformExpert/PCI0#0/AppleACPIPCI/IGPU#2/AppleIntelFramebuffer#2/display0/AppleDisplay-3dcb-e51:pscn" 10000'
But changing the file alone didn't apply the new underscan setting, so I tried restarting to see if the setting would take effect – it did.
So does anyone know how to change the underscan setting without restarting?
Thanks.

sinatra app can't find environmental variable but test script can

I'm using the presence of an environmental variable to determine if my app is deployed or not (as adversed to running on my local machine).
My test script can find and display the variable value but my according to my app the variable isn't present.
test.rb
Secret_Key_Path = ENV['APPLICATION_VERSION'] ? '/path/to/encrypted_data_bag_secret' : File.expand_path('~/different/path/to/encrypted_data_bag_secret')
puts ENV['APPLICATION_VERSION']
puts Secret_Key_Path
puts File.exists? Secret_Key_Path
info.rb (the relevant bit)
::Secret_Key_Path = ENV['APPLICATION_VERSION'] ? '/path/to/encrypted_data_bag_secret' : File.expand_path('~/different/path/to/encrypted_data_bag_secret')
If I log the value of Secret_Key_Path it logs as the value I don't expect (i.e. '~/different/path/to/encrypted_data_bag_secret' instead of '/path/to/encrypted_data_bag_secret')
Here's how I start my app (from inside of my main executable script, so I can just run app install from any where instead of having to go to the folder)
exec "(cd /path/to/app/root && exec sudo rackup --port #{80} --host #{'0.0.0.0'} --pid /var/run/#{NAME}.pid -O NAME[#{NAME}] -D)"
if I do env | grep APP I get:
APPLICATION_VERSION=1.0.130
APPLICATION_NAME=app-name
It was suggested that it was an execution context problem but I'm not sure how to fix that if it were that.
So Whats going on? Any help & suggestion would be appreciated.
You can keep your environment variables with sudo by using the -E switch:
From the manual:
-E, --preserve-env
Indicates to the security policy that the user wishes to preserve their existing environment variables. The security policy may
return an error if the user does not have permission to preserve the environment.
Example:
$ export APPLICATION_VERSION=1.0.130
$ export APPLICATION_NAME=app-name
Check the variables:
$ sudo -E env | grep APP
and you should get the output:
APPLICATION_NAME=app-name
APPLICATION_VERSION=1.0.130
Also if you want to keep variables permanently keeped you can add to the /etc/sudoers file:
Defaults env_keep += "APPLICATION_NAME APPLICATION_VERSION"

Resources