Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View mehdisadeghi's full-sized avatar

mehdisadeghi

View GitHub Profile
@mehdisadeghi
mehdisadeghi / gist:7b17a8eb5d5db2ae8de722d469d4a174
Created August 16, 2018 14:05
serverless-package-python-functions patch for pip upgrade and aws invoke local
121a122,124
> this.log('Upgrading pip inside the container.')
> this.runProcess('docker', ['exec', this.containerName, 'pip', 'install', '--upgrade', 'pip'])
> this.log('Pip upgrade finished.')
166a170,187
> loadEnvVars() {
> let pythonPath = ''
> if (this.globalIncludes) {
> this.log(`Adding global includes to the python path: ${this.globalIncludes}`)
> pythonPath += `:${this.globalIncludes}`
@mehdisadeghi
mehdisadeghi / byobu
Created October 2, 2017 11:58
Byobu startup file
#!/bin/bash
if [ -z "$(byobu list-sessions | grep code)" ]
then
byobu-tmux new-session -d #-t code # creates a new detached Byobu session
# Jupyter Window
byobu-tmux rename-window jupyter # Byobu comes up with one window, so rename that
byobu-tmux send-keys -t 0 'zsh' 'C-m'
byobu-tmux send-keys -t 0 'PYTHONHOME=$HOME jupyter notebook --no-browser --ip pc-p561' 'C-m'

Keybase proof

I hereby claim:

  • I am mehdisadeghi on github.
  • I am mehdisadeghi (https://keybase.io/mehdisadeghi) on keybase.
  • I have a public key ASDHyO9_jfn51twjitNp4hc9n35bGkkS0X7xSPI3Yjw5awo

To claim this, I am signing this object:

#
# Request-reply client in Python
# Connects REQ socket to tcp://localhost:5559
# Sends "Hello" to server, expects "World" back
#
import zmq
import sys
# Prepare our context and sockets
context = zmq.Context()
from twisted.application import service, internet
from twisted.python.log import ILogObserver
import sys, os
sys.path.append(os.path.dirname(__file__))
from kademlia.network import Server
from kademlia import log
application = service.Application("kademlia")
application.setComponent(ILogObserver, log.FileLogObserver(sys.stdout, log.INFO).emit)
@mehdisadeghi
mehdisadeghi / gist:2f313b941b4458351cfd
Created August 20, 2014 10:44
AttributeError: 'module' object has no attribute 'LeaseManager'
^C(sqmpy)pc-p282(/W5/sade/workspace/simple-queue-manager) export SAGA_VERBOSE=DEBUG
(sqmpy)pc-p282(/W5/sade/workspace/simple-queue-manager) python run.py
2014:08:20 12:43:54 27684 MainThread saga : [INFO ] saga-python version: 0.17
* Running on http://0.0.0.0:5001/
* Restarting with reloader
2014:08:20 12:43:56 27688 MainThread saga : [INFO ] saga-python version: 0.17
in submit.... before wrapper initialization
2014:08:20 12:44:00 27688 Dummy-1 saga.Engine : [INFO ] Loading adaptor saga.adaptors.context.myproxy
2014:08:20 12:44:00 27688 Dummy-1 saga.Engine : [INFO ] Register adaptor saga.adaptors.context.myproxy for saga.Context API with URL scheme(s) ['myproxy://']
2014:08:20 12:44:00 27688 Dummy-1 saga.Engine : [INFO ] Loading adaptor saga.adaptors.context.x509
2014:08:13 15:41:50 MainThread saga : [INFO ] saga-python version: 0.17
2014:08:13 15:41:50 MainThread saga.Engine : [INFO ] Loading adaptor saga.adaptors.context.myproxy
2014:08:13 15:41:50 MainThread saga.Engine : [INFO ] Register adaptor saga.adaptors.context.myproxy for saga.Context API with URL scheme(s) ['myproxy://']
2014:08:13 15:41:50 MainThread saga.Engine : [INFO ] Loading adaptor saga.adaptors.context.x509
2014:08:13 15:41:50 MainThread saga.Engine : [INFO ] Register adaptor saga.adaptors.context.x509 for saga.Context API with URL scheme(s) ['x509://']
2014:08:13 15:41:50 MainThread saga.Engine : [INFO ] Loading adaptor saga.adaptors.context.ssh
2014:08:13 15:41:50 MainThread saga.Engine : [INFO ] Register adaptor saga.adaptors.context.ssh for saga.Context API with URL scheme(s) ['ssh://']
2014:08:13 15:41:50 MainThread saga.Engine : [INFO ] Loading adaptor saga.ad
@mehdisadeghi
mehdisadeghi / gist:708672ddfa6350d99348
Created August 13, 2014 11:03
command not found inside sge script
(sqmpy-env)pc-p282(/W5/sade/workspace/saga-samples) SAGA_VERBOSE=DEBUG python sge.py
2014:08:13 12:58:00 MainThread saga : [INFO ] saga-python version: 0.17
2014:08:13 12:58:00 MainThread saga.Engine : [INFO ] Loading adaptor saga.adaptors.context.myproxy
2014:08:13 12:58:00 MainThread saga.Engine : [INFO ] Register adaptor saga.adaptors.context.myproxy for saga.Context API with URL scheme(s) ['myproxy://']
2014:08:13 12:58:00 MainThread saga.Engine : [INFO ] Loading adaptor saga.adaptors.context.x509
2014:08:13 12:58:00 MainThread saga.Engine : [INFO ] Register adaptor saga.adaptors.context.x509 for saga.Context API with URL scheme(s) ['x509://']
2014:08:13 12:58:00 MainThread saga.Engine : [INFO ] Loading adaptor saga.adaptors.context.ssh
2014:08:13 12:58:00 MainThread saga.Engine : [INFO ] Register adaptor saga.adaptors.context.ssh for saga.Context API with URL scheme(s) ['ssh://']
2014:0
(sqmpy-env)pc-p282(/W5/sade/workspace/simple-queue-manager) SAGA_VERBOSE=DEBUG python run.py
2014:08:13 12:27:00 MainThread saga : [INFO ] saga-python version: 0.17
* Running on http://0.0.0.0:5001/
* Restarting with reloader
2014:08:13 12:27:02 MainThread saga : [INFO ] saga-python version: 0.17
in submit.... before wrapper initialization
2014:08:13 12:27:05 Dummy-1 saga.Engine : [INFO ] Loading adaptor saga.adaptors.context.myproxy
2014:08:13 12:27:05 Dummy-1 saga.Engine : [INFO ] Register adaptor saga.adaptors.context.myproxy for saga.Context API with URL scheme(s) ['myproxy://']
2014:08:13 12:27:05 Dummy-1 saga.Engine : [INFO ] Loading adaptor saga.adaptors.context.x509
2014:08:13 12:27:05 Dummy-1 saga.Engine : [INFO ] Register adaptor saga.adaptors.context.x509 for saga.Context API with URL scheme(s) ['x509://']
(sqmpy-env)pc-p282(/W5/sade/workspace/saga-samples) SAGA_VERBOSE=DEBUG python sge.py
2014:08:13 12:15:01 MainThread saga : [INFO ] saga-python version: 0.17
2014:08:13 12:15:01 MainThread saga.Engine : [INFO ] Loading adaptor saga.adaptors.context.myproxy
2014:08:13 12:15:01 MainThread saga.Engine : [INFO ] Register adaptor saga.adaptors.context.myproxy for saga.Context API with URL scheme(s) ['myproxy://']
2014:08:13 12:15:01 MainThread saga.Engine : [INFO ] Loading adaptor saga.adaptors.context.x509
2014:08:13 12:15:01 MainThread saga.Engine : [INFO ] Register adaptor saga.adaptors.context.x509 for saga.Context API with URL scheme(s) ['x509://']
2014:08:13 12:15:01 MainThread saga.Engine : [INFO ] Loading adaptor saga.adaptors.context.ssh
2014:08:13 12:15:01 MainThread saga.Engine : [INFO ] Register adaptor saga.adaptors.context.ssh for saga.Context API with URL scheme(s) ['ssh://']
2014:0