Skip to content

Instantly share code, notes, and snippets.

View seanbehan's full-sized avatar

Sean Behan seanbehan

View GitHub Profile
@seanbehan
seanbehan / clear-sidekiq-jobs.sh
Created January 28, 2023 15:58 — forked from wbotelhos/clear-sidekiq-jobs.sh
Clear Sidekiq Jobs
require 'sidekiq/api'
# 1. Clear retry set
Sidekiq::RetrySet.new.clear
# 2. Clear scheduled jobs
Sidekiq::ScheduledSet.new.clear
@seanbehan
seanbehan / gist:2935f8b4df956f8693eabdc5c715a526
Created November 15, 2022 02:18 — forked from ekayxu/gist:5743138
Make Flask support regular expressions in its URL routing
#http://stackoverflow.com/questions/5870188/does-flask-support-regular-expressions-in-its-url-routing
#Even though Armin beat me to the punch with an accepted answer I thought I'd show an abbreviated example of how I implemented a regex matcher in Flask just in case anyone wants a working example of how this could be done.
from flask import Flask
from werkzeug.routing import BaseConverter
app = Flask(__name__)
class RegexConverter(BaseConverter):
def __init__(self, url_map, *items):
class TenantAwareManager(Manager):
def get_queryset(self):
tenant_id = current_tenant_id()
# If the manager was built from a queryset using
# SomeQuerySet.as_manager() or SomeManager.from_queryset(),
# we want to use that queryset instead of TenantAwareQuerySet.
if self._queryset_class != QuerySet:
return super().get_queryset().filter(tenant__id=tenant_id)
@seanbehan
seanbehan / node-walk.js
Created November 19, 2018 23:23 — forked from lovasoa/node-walk.es6
Walk through a directory recursively in node.js.
var fs = require("fs"),
path = require("path");
function walk(dir, callback) {
fs.readdir(dir, function(err, files) {
if (err) throw err;
files.forEach(function(file) {
var filepath = path.join(dir, file);
fs.stat(filepath, function(err,stats) {
if (stats.isDirectory()) {
//
// LoadingOverlay.swift
// app
//
// Created by Igor de Oliveira Sa on 25/03/15.
// Copyright (c) 2015 Igor de Oliveira Sa. All rights reserved.
//
// Usage:
//
// # Show Overlay
@seanbehan
seanbehan / craiglist-apa.py
Created April 24, 2016 16:28 — forked from anonymous/craiglist-apa.py
parse craigslist apartments in vermont
from lxml.html import fromstring as html, tostring as tos
from requests import get
import xmltodict
import json
results = []
URL = 'http://vermont.craigslist.org/search/apa'
for el in html(get(URL).text).xpath("//p[@class='row']"):
results.append(xmltodict.parse(tos(el)))

install php

with mysql pgsql intl support

$ brew install php --with-apache --with-mysql --with-pgsql --with-intl

set php timezone in php ini

date.timezone = Europe/Vienna
namespace :deploy do
desc "Hot-reload God configuration for the Resque worker"
task :reload_god_config do
sudo "god stop resque"
sudo "god load #{File.join(deploy_to, 'current', 'config', 'resque-' + rails_env + '.god')}"
sudo "god start resque"
end
end
# append to the bottom:
virtualenv --no-site-packages .
source bin/activate
bin/pip install tornado
bin/pip freeze > requirements.txt
mkdir app
git init
cat >.gitignore <<EOF
bin/
include/
lib/
@seanbehan
seanbehan / leaflet.html
Created October 31, 2012 22:30 — forked from springmeyer/leaflet.html
leaflet simple example of portland point
<html>
<head>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.3.1/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet-0.3.1/leaflet.js"></script>
</head>
<body>
<div id="map" style="width: 100%; height: 100%"></div>
<script>
var map = new L.Map('map');
var osm = new L.TileLayer('http://tile.osm.org/{z}/{x}/{y}.png');