Skip to content

Instantly share code, notes, and snippets.

View gbrault's full-sized avatar
🏠
Working from home

Gilbert Brault gbrault

🏠
Working from home
  • Vence
View GitHub Profile
@p3trus
p3trus / custom.js
Last active September 26, 2019 07:58
Adds a button to the ipython notebook toolbar to hide/show the input code cell. To use it, you have to put the custom.js file in your `.ipython_<profile name>/static/custom/` folder, where *<profile name>* is the ipython profile in use.
$([IPython.events]).on('notebook_loaded.Notebook', function(){
IPython.toolbar.add_buttons_group([
{
'label' : 'toggle input cells',
'icon' : 'icon-refresh',
'callback': function(){$('.input').slideToggle()}
}
]);
});
@Lukas238
Lukas238 / Pure JavaScript dynamic scripts loader and callback function.md
Last active December 22, 2021 17:12
Pure JavaScript dynamic scripts loader + callback function

This pure javascript function allows to dynamically include a script and then execute any function by using a callback.

  
/**********************************
*	FUNCTIONS
***********************************/

function loadScript(url, callback){
	var script = document.createElement("script"); 
@Girgitt
Girgitt / sftpserver_main.py
Created July 13, 2016 20:34
multithreaded sftp server in python based on https://github.com/rspivak/sftpserver
import time
import socket
import optparse
import sys
import textwrap
import paramiko
from sftpserver.stub_sftp import StubServer, StubSFTPServer
You can ssh into the VM by finding the IP (from kubectl config view) and using username "docker" password "tcuser":
ssh docker@192.168.XX.XX
@naushadzaman
naushadzaman / flask_restart.py
Created November 8, 2016 14:06
Reload python flask server by function / API endpoint
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Reload python flask server by function / API endpoint
# References:
# https://docs.python.org/3/library/multiprocessing.html
# http://stackoverflow.com/questions/27723287/reload-python-flask-server-by-function
import os
@joncardasis
joncardasis / WebServer.py
Created February 7, 2017 21:08
A simple and quick HTTP web server in Python
"""
Author: Jonathan Cardasis
"""
import socket
import signal # Allow socket destruction on Ctrl+C
import sys
import time
import threading
@Davor111
Davor111 / sshuttle.sh
Created February 17, 2017 08:34
How to use sshuttle with .key, .csr or .pem files for authentication
#It's not directly mentioned in the documentation on how to do this, so here you go. This command will tunnel everything including DNS:
sshuttle --dns -vr user@yourserver.com 0/0 --ssh-cmd 'ssh -i /your/key/path.pem'
@deargle
deargle / client.conf
Last active June 1, 2024 12:32
OpenVPN server.conf and client.conf
##############################################
# Sample client-side OpenVPN 2.0 config file #
# for connecting to multi-client server. #
# #
# This configuration can be used by multiple #
# clients, however each client should have #
# its own cert and key files. #
# #
# On Windows, you might want to rename this #
# file so it has a .ovpn extension #
@mill1000
mill1000 / README.md
Last active April 22, 2024 07:24
Headless A2DP Audio Streaming on Raspbian Stretch

About

This gist will show how to setup Raspbian Stretch as a headless Bluetooth A2DP audio sink. This will allow your phone, laptop or other Bluetooth device to play audio wirelessly through a Rasperry Pi.

Motivation

A quick search will turn up a plethora of tutorials on setting up A2DP on the Raspberry Pi. However, I felt this gist was necessary because this solution is:

  • Automatic & Headless - Once setup, the system is entirely automatic. No user iteration is required to pair, connect or start playback. Therefore the Raspberry Pi can be run headless.
  • Simple - This solution has few dependencies, readily available packages and minimal configuration.
  • Up to date - As of December 2017. Written for Raspbian Stretch & Bluez 5.43

Prerequisites

---
version: '2'
services:
jupyter:
image: jupyter/scipy-notebook
container_name: jupyter
command: start.sh jupyter lab --LabApp.token='*******************' --LabApp.allow_remote_access='True' --LabApp.allow_origin='*'
restart: always