Skip to content

Instantly share code, notes, and snippets.

View jvkersch's full-sized avatar

Joris Vankerschaver jvkersch

View GitHub Profile
@jvkersch
jvkersch / ssh_auth_sock.md
Last active March 23, 2024 14:59
Updating SSH_AUTH_SOCK in an already established tmux session

I found this information somewhere on StackOverflow but I forgot exactly where. I'm paraphrasing what I learned here, for future reference.

SSH uses a Unix socket to communicate with other processes. The socket's path can be found by looking at the environment variable $SSH_AUTH_SOCK. When you re-connect to a tmux session that was started during a previous SSH session, this variable will contain the path of the previous SSH auth socket, and this will cause processes that try to connect to your authentication agent to fail. To fix this, we have to

  1. Create a symlink from the auth socket to a fixed path somewhere, so that we can refer to it later on. In ~/.ssh/rc, add
if test "$SSH_AUTH_SOCK"; then
	ln -sf $SSH_AUTH_SOCK ~/.ssh/ssh_auth_sock
fi
diff --git a/Modules/getpath.c b/Modules/getpath.c
index de96d47..8487208 100644
--- a/Modules/getpath.c
+++ b/Modules/getpath.c
@@ -7,7 +7,7 @@
#include <string.h>
#ifdef __APPLE__
-#include <mach-o/dyld.h>
+#include <dlfcn.h>
#include <math.h>
#include <stdio.h>
#include <Python.h>
#include "numpy/npy_math.h"
/* Comparing numpy's fallback implementation of log1p with that of the C
standard library.
Compile with
""" Obtain a quote of the Dow Jones Industrial Average from Bloomberg.
"""
import json
from bs4 import BeautifulSoup
import requests
url = 'http://www.bloomberg.com/quote/INDU:IND'
@jvkersch
jvkersch / bad.c
Last active March 29, 2020 10:05
Bug in Apple's vecLib (OS X < 10.10)
/* proof-of-concept incorrect */
@jvkersch
jvkersch / browser.py
Created September 10, 2014 09:37
Quickly open a web page to display a variable in IPython
import webbrowser
from tempfile import NamedTemporaryFile
from IPython.core.magic import Magics, magics_class, line_magic
@magics_class
class BrowserMagics(Magics):
@line_magic
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jvkersch
jvkersch / backup_script.py
Last active June 9, 2017 18:08
Python wrapper around to rsync to facilitate backup
#!/usr/bin/env python
"""
A simple wrapper around rsync for backup.
Usage: create a text file with on each line a resource that you wish to
backup. Paths should be relative to the user's home directory. Entries
starting with '#' are ignored, as are blank lines. Call this script via
python backup_script.py -i [backup_files.txt] [rsync_target_folder]