Skip to content

Instantly share code, notes, and snippets.

View alfredodeza's full-sized avatar
:octocat:

Alfredo Deza alfredodeza

:octocat:
View GitHub Profile
@alfredodeza
alfredodeza / histfile
Last active March 25, 2017 15:11
How I got netatalk 3.0.1 working in SmartOS
CFLAGS=-I/opt/local/include LDFLAGS=-L/opt/local/lib ./configure --with-bdb=/opt/local --with-init-style=solaris --without-pam --prefix=/opt/local --with-init-dir=/var/svc/manifest/network/ --with-ssl-dir=/opt/local --with-libgcrypt --prefix=/opt/local
LD_OPTIONS="-D libs,detail" CFLAGS=-I/opt/local/include LDFLAGS=-L/opt/local/lib make clean install
LD_OPTIONS="-D libs,detail" CC=gcc CFLAGS=-I/opt/local/include LDFLAGS=-L/opt/local/lib make clean install
ls /opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.0/
ln -s /opt/local/lib/libiconv.so /opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.0/
LD_OPTIONS="-D libs,detail" CC=gcc CFLAGS=-I/opt/local/include LDFLAGS=-L/opt/local/lib make clean install
ln -s /opt/local/lib/libwrap.so /opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.0/
LD_OPTIONS="-D libs,detail" CC=gcc CFLAGS=-I/opt/local/include LDFLAGS=-L/opt/local/lib make clean install
@alfredodeza
alfredodeza / gist:5905095
Created July 1, 2013 22:13
Attempting to compile onto tasseo
/opt/heroku-buildpack-ruby/bin/compile .
-----> Using Ruby version: ruby-1.9.2
-----> Installing dependencies using
sh: -c: line 0: unexpected EOF while looking for matching ``'
sh: -c: line 1: syntax error: unexpected end of file
sh: -c: line 0: unexpected EOF while looking for matching ``'
sh: -c: line 1: syntax error: unexpected end of file
/opt/heroku-buildpack-ruby/lib/language_pack/ruby.rb:616:in `load_bundler_cache': private method `load' called for nil:NilClass (NoMethodError)
from /opt/heroku-buildpack-ruby/lib/language_pack/ruby.rb:430:in `block in build_bundler'
from /opt/heroku-buildpack-ruby/lib/language_pack/base.rb:91:in `log'
@alfredodeza
alfredodeza / run.py
Last active September 5, 2017 22:14
Serve a WSGI application + static files with CherryPy
import os
import cherrypy
from cherrypy import wsgiserver
from my_wsgi_app import wsgi
PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), 'public'))
class Root(object):
@alfredodeza
alfredodeza / gist:6319156
Created August 23, 2013 13:07
Supervisor in Ubuntu
First remove the apt-get supervisor version:
sudo apt-get remove supervisor
Kill the backend supervisor process:
sudo ps -ef | grep supervisor
Then get the newest version(apt-get version was 3.0a8):
@alfredodeza
alfredodeza / zpool_config
Created April 21, 2014 13:23
zpool get all zones
zpool get all zones
NAME PROPERTY VALUE SOURCE
zones size 2.72T -
zones capacity 42% -
zones altroot - default
zones health ONLINE -
zones guid 1181797254408314611 default
zones version - default
zones bootfs - default
zones delegation on default
@alfredodeza
alfredodeza / gist:88ea216f2cd57797b737
Last active August 29, 2015 14:02
Run a Vim command on a bunch of files
# For a bunch of Python files
vim -c "bufdo! set eventignore-=Syntax| %s/original/replacement/gce" *.py
# if you want to save as you go
vim -c "bufdo! set eventignore-=Syntax| %s/original/replacement/gce | update" *.py
# Breaking it down:
# bufdo! -> so that it doesn't complain about erroring
# set eventignore-=Syntax -> so that every buffer gets syntax highlighting
# /gce -> optional, global search in the line with confirmation and eating up the errors
@alfredodeza
alfredodeza / mix_out.py
Created June 27, 2014 13:47
alternating stderr with stdout with subprocess.Popen
# ideally we would have output like:
$ python process.py
this is an stderr line
this is an stdout line
this is an stderr line
this is an stdout line
@alfredodeza
alfredodeza / gist:77e623624246c4b92b9f
Created August 30, 2014 21:31
Trying to use py.test fixtures with Pecan + SQLAlchemy
# app name: ayni
# this works, inheriting from it, committing and re-using the database
#
# ayni model __init__.py file doesn't have anything odd and can be found:
# https://github.com/alfredodeza/ayni/blob/master/ayni/models/__init__.py
#
import os
from unittest import TestCase
from pecan import set_config
from pecan.testing import load_test_app
@alfredodeza
alfredodeza / real.py
Last active April 26, 2022 10:58
Real time subprocess stdout/stderr
import logging
import threading
import os
import subprocess
logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.INFO)
class LogPipe(threading.Thread):
@alfredodeza
alfredodeza / generate.py
Created November 7, 2014 03:02
a simple markov phrase generator
import random
class Markov(object):
def __init__(self, open_file):
self.cache = {}
self.open_file = open_file
self.words = self.file_to_words()
self.word_size = len(self.words)