Skip to content

Instantly share code, notes, and snippets.

@egroeper
egroeper / gnome_proxy_to_env.md
Last active July 9, 2023 14:38 — forked from JPvRiel/gnome_proxy_to_env.md
a shell wrapper to pull org.gnome.proxy settings into env, e.g. http_proxy, which is useful for .desktop files

Why?

Useful for:

  • updating current terminal's shell env proxy settings, or
  • wrapping exec in .desktop files to inject env proxy settings

GNOME proxy settings should normally get propergated into the shell (bash) environment via gnome-terminal, e.g. http_proxy and no_proxy. However:

  • I noticed that applications exectuted via .desktop entries sometimes don't work. This happens when an app ignores org.gnome.proxy settings but can often use proxy env vars from the shell.
  • If you're proxy settings change, existing shell processes will still have the old proxy enviroment variables, so this can help refresh them whithout having to create a new shell.
#include<stdio.h>
#include <unistd.h>
//#include <libmemcached/memcached.h>
#include <libmemcached-1.0/memcached.h>
#include <libmemcachedutil-1.0/pool.h>
int main() {
const char *config_string= "--SERVER=192.168.1.2 --SERVER=192.168.1.3 --POOL-MIN=10 --POOL-MAX=100 --DISTRIBUTION=consistent --HASH=MD5 --REMOVE-FAILED-SERVERS=1";
char *key= "de.hu-berlin.cms_our_test_key";
diff --git a/tests/seahubtests.sh b/tests/seahubtests.sh
index 9fa1d21..0d05a8a 100755
--- a/tests/seahubtests.sh
+++ b/tests/seahubtests.sh
@@ -26,6 +26,8 @@ fi
set -x
SEAHUB_TESTSDIR=$(python -c "import os; print os.path.dirname(os.path.realpath('$0'))")
SEAHUB_SRCDIR=$(dirname "${SEAHUB_TESTSDIR}")
+# include CONFIG VARIABLES
+. $SEAHUB_SRCDIR/setenv.sh
import re
from Exscript.protocols.drivers.driver import Driver
_user_re = [re.compile(r'login: ', re.I)]
_password_re = [re.compile(r'password: $')]
_prompt_re = [re.compile(r'[A-Z]{4,5}\d{2}>\s$')]
class ZhoneMALCDriver(Driver):
def __init__(self):
Driver.__init__(self, 'zhonemalc')
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "ubuntu/trusty64"
# The url from where the 'config.vm.box' box will be fetched if it
# doesn't already exist on the user's system.
config.vm.box_url = "https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box"
@egroeper
egroeper / vagrant_ansible_timeout_bug.log
Created July 21, 2015 14:08
vagrant ansible rollout problem
This file has been truncated, but you can view the full file.
egroeper@laptop ~/Fileservice/configstack[feature/ci-tests*]$ vagrant destroy -f
==> clone1: Forcing shutdown of VM...
==> clone1: Destroying VM and associated drives...
==> clone1: Running cleanup tasks for 'ansible' provisioner...
==> memcached: Forcing shutdown of VM...
==> memcached: Destroying VM and associated drives...
==> bgnode: Forcing shutdown of VM...
==> bgnode: Destroying VM and associated drives...
==> master: Forcing shutdown of VM...
==> master: Destroying VM and associated drives...
@egroeper
egroeper / ssh-copy-pubkey.sh
Created April 24, 2015 21:22
ssh-copy-pubkey BASH function for .bashrc
# ssh-copy-pubkey <keyfile.pub> [user@]host
# this one avoids duplicates (stupid version by using fgrep, should only check pubkey part, not comments)
ssh-copy-pubkey() {
export PUBKEYTOCOPY=$(cat $1); ssh $2 "mkdir -p .ssh ; touch .ssh/authorized_keys ; if ! fgrep -q \"$PUBKEYTOCOPY\" .ssh/authorized_keys ; then echo $PUBKEYTOCOPY >> .ssh/authorized_keys; fi"; unset PUBKEYTOCOPY
}
#!/bin/bash
# XFCE Shortcut Settings:
# Settings -> Keyboard -> Shortcuts
# XF86TouchpadToggle makes to work using the Touchpad key on the keyboard (FN+F5)
enabled=`xinput --list-props "AlpsPS/2 ALPS GlidePoint" | grep -e "Device Enabled\ (135):\s*1"`
if [ -n "$enabled" ]; then
xinput --set-prop "AlpsPS/2 ALPS GlidePoint" "Device Enabled" 0