Skip to content

Instantly share code, notes, and snippets.

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

Leonardo J. Caballero G. macagua

🏠
Working from home
View GitHub Profile
https://www.varnish-cache.org/installation/redhat
http://repo.varnish-cache.org/source/
https://www.varnish-cache.org/docs/3.0/tutorial/starting_varnish.html
yum install pcre
yum install pcre-devel
wget http://repo.varnish-cache.org/source/varnish-3.0.0.tar.gz
tar xvzf varnish-3.0.0.tar.gz
@toutpt
toutpt / .travis.yml
Last active December 11, 2015 10:19
This is boiler plate to use travis-ci in your plone addon
language: python
python: 2.7
env:
- TARGET=test
- TARGET=coverage.sh
- TARGET=python-validation.sh
# - TARGET=css-validation.sh
# - TARGET=js-validation.sh
@mgedmin
mgedmin / pov-update-ztk-py3-status.sh
Last active October 23, 2019 15:34
Daily cron script that updates dynamic data at https://zope3.pov.lt/py3/
#!/bin/sh
# update dynamic files in /var/www/zope3.pov.lt/py3/
# /opt/ztk-py3-status/ is a checkout of https://github.com/mgedmin/ztk-py3-status
# /opt/ztk-py3-status/*.py require python3
# sponge requires moreutils
# convert requires imagemagick
# dot and neato require graphviz
cache_dir=/stuff/pypi-cache
@msabramo
msabramo / run_sqlalchemy_tests.py
Created February 4, 2013 23:47
Proposed way to run SQLAlchemy tests within pymssql (see http://code.google.com/p/pymssql/issues/detail?id=45). Example invocation: python tests/run_sqlalchemy_tests.py -v test.dialect.test_mssql
#!/usr/bin/env python
import ConfigParser
import os
import sys
import tarfile
import urllib
SQLALCHEMY_VERSION = "0.8.0b2"
SQLALCHEMY_DIR = "SQLAlchemy-%s" % SQLALCHEMY_VERSION
@adamgreenhall
adamgreenhall / df2json.py
Last active October 12, 2019 21:13 — forked from ameliagreenhall/df2json.py
Convert pandas.DataFrame to JSON (and optionally write the JSON blob to a file).
"""
tiny script to convert a pandas data frame into a JSON object
"""
import json as json
def df_to_json(df, filename=''):
x = df.reset_index().T.to_dict().values()
if filename:
with open(filename, 'w+') as f: f.write(json.dumps(x))
"""
Use with
bin/instance run export_skin_folder.py
This script will extract the portal_skins folder
named in SKINFODLER_NAME to the DEST directory
"""
import os
import sys
PLONE_PORTAL = 'Plone'
@webbyfox
webbyfox / bootstrap.py
Created June 24, 2013 10:56
Plone 4.3 bootstrap.py file
##############################################################################
#
# Copyright (c) 2006 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# Enable backports
echo "deb deb http://ftp.debian.org/debian/ wheezy-backports main" >> /etc/apt/sources.list
# System up-to-date
apt-get update && apt-get dist-upgrade
apt-get install sudo
# Install all packages we need (nginx will be installed later... see :156)
apt-get install -y \
vim \
@eliezerfot123
eliezerfot123 / comprobar_url
Last active May 3, 2022 02:57
COMPROBAR QUE UNA WEB ESTE DISPONIBLE EN PYTHON
rewimport httplib
import urlparse
# funcion que se encarga de obtener respuesta del estatus del servidor web
def get_server_status_code(url):
# descarga sólo el encabezado de una URL y devolver el código de estado del servidor.
host, path = urlparse.urlparse(url)[1:3]
try:
conexion = httplib.HTTPConnection(host)
conexion.request('HEAD', path)
@andreagrandi
andreagrandi / gdata_read.py
Last active October 30, 2019 22:30
Read a Google Docs spreadsheet document from Python.
# Copyright (c) 2013, Andrea Grandi and individual contributors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1) Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2) Redistributions in binary form must reproduce the above copyright notice,