Skip to content

Instantly share code, notes, and snippets.

@josegonzalez
josegonzalez / redis_migrate.py
Last active April 25, 2024 02:34 — forked from iserko/redis_migrate.py
A simple script to migrate all keys from one Redis to another
#!/usr/bin/env python
import argparse
import redis
def connect_redis(conn_dict):
conn = redis.StrictRedis(host=conn_dict['host'],
port=conn_dict['port'],
db=conn_dict['db'])
return conn
@josegonzalez
josegonzalez / deploy.rb
Created October 23, 2010 16:40
Capistrano Deploy Script for CakePHP applications using GIT (Update the $config hash))
$config = {
"application" => "DOMAIN.TLD",
"repository" => "git@GITHOST:USERNAME/REPOSITORYNAME.git",
"remoteusername" => "REMOTEUSERNAME",
"cake_folder" => "/PATH/TO/CAKE",
"cake_version" => "cakephp1.3",
"plugin_dir" => "plugins",
"servers" => {
"prod" => {
"server" => "APPLICATION.TLD",
@josegonzalez
josegonzalez / access.lua
Created December 3, 2012 18:26
Simple lua file enabling oauth support for nginx via nginx-lua and access_by_lua.
- certain endpoints are always blocked
if nginx_uri == "/_access_token" or nginx_uri == "/_me" then
ngx.exit(403)
end
-- import requirements
local cjson = require "cjson"
-- setup some app-level vars
local app_id = "APP_ID"
@josegonzalez
josegonzalez / Dockerfile
Last active May 29, 2022 21:06
bootstrap a new dev server
FROM gitpod/openvscode-server:latest
USER root
ARG GO_VERSION=1.18.2.linux-amd64
RUN curl -o /tmp/go.tar.gz -sSL https://go.dev/dl/go1.18.2.linux-amd64.tar.gz && \
tar -C /usr/local -xzf /tmp/go.tar.gz && \
rm -rf /tmp/go.tar.gz
USER openvscode-server
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin
@josegonzalez
josegonzalez / .gitconfig
Created September 5, 2010 07:45
My ~/.gitconfig
[user]
name = MY_NAME
email = MY_EMAIL_ADDRESS
[git-tmbundle]
gitnub-path = /Applications/GitNub.app
gitx-path = /Applications/GitX.app
show-diff-check = yes
[github]
user = GITUB_USER
token = GITHUB_TOKEN
@josegonzalez
josegonzalez / nginx_release.sh
Last active October 11, 2019 15:46
Make an nginx release for ubuntu
#!/bin/bash
#####
# Builds a custom nginx
#
# RELEASE_TAGS="+your+tags+here"
# RELEASE_MAINTAINER="Your Name Here"
# RELEASE_MAINTAINER_EMAIL="hi@example.com"
# RELEASE_MESSAGE="Some message"
#
@josegonzalez
josegonzalez / category.rb
Created August 14, 2010 21:41
Category plugin for Jekyll
module Jekyll
class CategoryIndex < Page
def initialize(site, base, dir, category)
@site = site
@base = base
@dir = dir
@name = 'index.html'
self.process(@name)
self.read_yaml(File.join(base, '_layouts'), 'category_index.html')
@josegonzalez
josegonzalez / readme.md
Last active November 17, 2018 16:16
Example Readme for CakePHP plugins that use MIT license

[PLUGIN NAME] Plugin

[ONE LINE DESCRIPTION OF PROJECT]

Background

[A PARAGRAPH DESCRIBING WHY YOU BUILT THIS]

[ANOTHER PARAGRAPH DESCRIBING YOUR IMPETUS FOR RELEASING THIS]

@josegonzalez
josegonzalez / subdomain.php
Created December 19, 2011 21:00
subdomain component for cakephp that depends on a model
<?php
class SubdomainComponent extends Object {
var $__settings = array(
'base' => 'example.com',
'domains' => array(),
'param' => 'subdomain',
'redirect' => true,
'redirectTo' => 'http://example.com',
'model' => 'DomainPrefix',
@josegonzalez
josegonzalez / nginx-custom.rb
Created November 21, 2012 17:53
Customize your Nginx Installation via Homebrew
require 'formula'
class NginxCustom < Formula
homepage 'http://nginx.org/'
url 'http://nginx.org/download/nginx-1.2.4.tar.gz'
sha1 'e3de0b2b82095f26e96bdb461ba36472d3e7cdda'
devel do
url 'http://nginx.org/download/nginx-1.3.8.tar.gz'
sha1 '84ff39e3f76e9f496f4e05080885e04caf472bb9'