Skip to content

Instantly share code, notes, and snippets.

View kevinlondon's full-sized avatar

Kevin London kevinlondon

View GitHub Profile
@fabd
fabd / install ruby and jekyll on mac mini m1 apple silicon.md
Last active August 22, 2023 00:27
Install JEKYLL for GITHUB PAGES on Mac Mini M1 ( AUGUST 2021 )

NOTES

  • I only care about running jekyll for Github Pages.
  • ruby 3.x doesn't seem to work correctly with Jekyll
  • since I don't care about any other users on my machine, I will NOT install gems to user folder to simplify the process

Double check the pre-installed version of RUBY we DONT want (version 2.6)

$ ruby -v
@DragonBe
DragonBe / php_apache_homebrew.md
Last active November 20, 2022 18:15
Installation of Apache 2.4 and PHP 7.1 with Homebrew

I posted several talks about compiling PHP from source, but everyone was trying to convince me that a package manager like Homebrew was a more convenient way to install.

The purpose of Homebrew is simple: a package manager for macOS that will allow you to set up and install common packages easily and allows you to update frequently using simple commands.

I used a clean installation of macOS Sierra to ensure all steps could be recorded and tested. In most cases you already have done work on your Mac, so chances are you can skip a few steps in this tutorial.

Apache and PHP with homebrew

I’ve made this according to the installation instructions given on GetGrav.

@thomasst
thomasst / migrate-redis.py
Created May 14, 2015 18:26
Migrate Redis data on Amazon ElastiCache
"""
Copies all keys from the source Redis host to the destination Redis host.
Useful to migrate Redis instances where commands like SLAVEOF and MIGRATE are
restricted (e.g. on Amazon ElastiCache).
The script scans through the keyspace of the given database number and uses
a pipeline of DUMP and RESTORE commands to migrate the keys.
Requires Redis 2.8.0 or higher.
@booherbg
booherbg / migration.md
Last active July 25, 2022 20:20
Migrating from Elixir to SQLAlchemy declarative

I have a project that's a few years old, but needs some maintenance. Since I last worked on the project, two major things have happened. First, Elixir -- a declarative layer on top of SQLAlchemy -- has not been maintained. Secondly, SQLAlchemy now has its own declarative layer.

Rather than continue using Elixir, I decided to migrate my data models to use the new SQLAlchemy declarative layer, which interestingly enough appear to be relatively compatible with Elixir's philosophy.

The first thing I did was do a direct mapping in my model columns and update the import statements.

# from Elixir import Entity, Field, DateTime, Unicode, Integer, Boolean, setup_all, create_all, session, metadata
from sqlalchemy import Column, DateTime, String, Integer, ForeignKey, Boolean
from sqlalchemy.ext.declarative import declarative_base
@ExpandOcean
ExpandOcean / kivy_cv.py
Created January 7, 2015 06:48
kivy and opencv work together demo
# coding:utf-8
from kivy.app import App
from kivy.uix.image import Image
from kivy.clock import Clock
from kivy.graphics.texture import Texture
import cv2
class KivyCamera(Image):
def __init__(self, capture, fps, **kwargs):
@jfalkson
jfalkson / Sample LaTeX file
Created August 30, 2014 00:54
Sample LaTeX file
\documentclass[10pt]{article}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{amsmath}
%\usepackage{fullpage}
%\usepackage{graphicx}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Begin user defined commands
@inklesspen
inklesspen / post-checkout.py
Created June 10, 2014 21:54
Post-checkout hook to detect alembic issues when switching branches.
#!/usr/bin/env python
"""
Provide useful alembic information after switching branches.
"""
import argparse
import subprocess
import os
import os.path
import py.path
@john2x
john2x / uwsgi-emperor
Last active May 19, 2016 23:41
uWSGI Emperor init script (Ubuntu 12.04)
#!/bin/sh
### BEGIN INIT INFO
# Provides: uwsgi-emperor
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the uwsgi emperor app server
# Description: starts uwsgi app server using start-stop-daemon
@hest
hest / gist:8798884
Created February 4, 2014 06:08
Fast SQLAlchemy counting (avoid query.count() subquery)
def get_count(q):
count_q = q.statement.with_only_columns([func.count()]).order_by(None)
count = q.session.execute(count_q).scalar()
return count
q = session.query(TestModel).filter(...).order_by(...)
# Slow: SELECT COUNT(*) FROM (SELECT ... FROM TestModel WHERE ...) ...
print q.count()
@gregelin
gregelin / python_test_framework_rd.md
Last active April 2, 2019 08:30
Research on Python test frameworks for ATDD (Acceptance Testing Driven Development)

What am I trying to do?

Working with SCAP is daunting. I'm in the "Sho" stage of "Sho Ha Re". SCAP is running, but only because I am following specific directions. There are hundreds of selected controls for SSG and STIG using SCAP. The basic runs only passes about half of the tests and there are many tests not even selected.

Breaking the STIG down would be helpful. For example, there are only 17 "Severity: High" tests. Wouldn't it make sense to have a test file that tests only for those 17?

What I'm trying to do is to create a simpler version of a STIG, a STIG that only tests a single control, or only the 17 "high" severity tests. I could of course manually pull out these tests. And I may do that. But a smarter approach would be to programatically build a small subset from the published source material. That way, I'm extracting the code.

I'm committed to acceptance test driven development. So I want the extracted controls. I need to write code to extract the controls. I need a way of testing my extr