Skip to content

Instantly share code, notes, and snippets.

View 4O4's full-sized avatar

Paweł K 4O4

  • 16:23 (UTC +02:00)
View GitHub Profile

Keybase proof

I hereby claim:

  • I am 4o4 on github.
  • I am pkiyooniq (https://keybase.io/pkiyooniq) on keybase.
  • I have a public key ASDtbilOtxr3ddpuN67uRHQDZBK_Y5bXMhF4WlbIwJDpego

To claim this, I am signing this object:

@4O4
4O4 / get_remote_var.sh
Last active February 26, 2018 09:05
Get value of environment variable from remote server. Wrapper around remote_exec gist (https://gist.github.com/4O4/18b69f34001439a2b01532c1ae377aa2)
#!/usr/bin/env bash
# Get remote_exec.sh from another gist: https://gist.github.com/4O4/18b69f34001439a2b01532c1ae377aa2
source remote_exec.sh
get_remote_var() {
remote_exec ${1} "echo -n \${${2}}"
}
# Usage example
@4O4
4O4 / remote_exec.sh
Last active February 26, 2018 08:58
Execute commands on remote server (with env variables properly initialized) and get the stdout while ignoring any potential spam and errors outputted by Bash login scripts
#!/usr/bin/env bash
remote_exec() {
# Goals:
# 1. Force allocate pseudo-tty (usually not needed; IIRC I was hitting some
# edge cases related to cygwin / windows cooperation in the past without
# this switch. Life is a little bit easier after migration to WSL.
# 2. Connect to remote server and launch custom command instead of login shell.
# 3. Source .bash_profile to initialize environment and stuff, but ignore its
# stdout and stderr.
@4O4
4O4 / 0_reuse_code.js
Created February 22, 2017 09:52
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console