Skip to content

Instantly share code, notes, and snippets.

View david-batranu's full-sized avatar

David Bătrânu david-batranu

View GitHub Profile
@david-batranu
david-batranu / mkpth.py
Last active March 22, 2023 10:51
Create buildout.pth in site-packages so virtualenv knows about buildout paths
#!/usr/bin/env python
import os
import sys
from distutils.sysconfig import get_python_lib
SITE_PACKAGES = get_python_lib()
BUILDOUT_PTH = os.path.join(SITE_PACKAGES, 'buildout.pth')
;; enable melpa
(require 'package) ;; You might already have this line
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/"))
(when (< emacs-major-version 24)
;; For important compatibility libraries like cl-lib
(add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")))
(package-initialize) ;; You might already have this line
;; /enable melpa
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default
;; Base distribution to use. This is a layer contained in the directory
#!/usr/env python2
from urllib2 import urlopen
URL = 'https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts'
hosts = urlopen(URL)
output = []
@david-batranu
david-batranu / init.vim
Last active October 14, 2016 17:33
nvim config
call plug#begin('~/.config/nvim/plugged')
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'neomake/neomake'
Plug 'kien/rainbow_parentheses.vim'
Plug 'scrooloose/nerdtree'
Plug 'Yggdroot/indentLine'
Plug 'groenewege/vim-less'
Plug 'flazz/vim-colorschemes'
@david-batranu
david-batranu / checkip.py
Created October 8, 2016 11:13
Verifies if the IP has changes, if it did launch argv[1].
#!/usr/bin/env python
import os
import sys
from urllib2 import urlopen
from subprocess import call
URL = 'http://icanhazip.com/'
IP_FILE = '/tmp/lastip.txt'
@david-batranu
david-batranu / .dir-locals.el
Created December 16, 2016 10:37
emacs pyvenv-mode
((nil . ((pyvenv-workon . "buildout-folder-name"))))
@david-batranu
david-batranu / year_validator.py
Created February 28, 2017 21:13
functional implementation of a year validator
from functools import reduce
from functools import wraps
def log_in_out(func):
@wraps(func)
def wrapper(*args, **kwargs):
result = func(*args, **kwargs)
print('{} in: {}, out: {}'.format(func.__name__, args, result))
return result
ssh -f -g -L 3689:127.0.0.1:3689 -N username@hostname
avahi-publish-service sharename _daap._tcp 3689 &
@david-batranu
david-batranu / buildout.cfg
Last active September 19, 2017 09:26
plone-wsgi
# Install uwsgi>=2.0.15 (requires build-essential and python-dev)
# adding it to eggs should also work, assuming you have gcc
[buildout]
parts +=
instance
uwsgi-app
uwsgi-run
[uwsgi-run]