Skip to content

Instantly share code, notes, and snippets.

@msporleder
msporleder / .vimrc
Created November 20, 2020 14:42
my .vimrc
set wildmenu
set wildmode=list,full
set nocompatible
set syntax=on
set scrolloff=4
filetype plugin indent on
colorscheme jellybeans
"set tw=4
set tabstop=2
set undodir=~/.vim/undo//,/tmp//
@msporleder
msporleder / apache_for_nginx.md
Last active May 25, 2019 15:16
apache for nginx users

Apache httpd has been around for a long time but a lot of people now have first experiences with nginx.

This is a simple guide to help translate some nginx concepts into apache configs

introduction & basics

nginx is only event-driven
Apache can be event-driven with mpm_event

nginx mostly uses static linking for modules whereas apache mostly uses dynamic linking for modules
both servers support both methods, but the common defaults differ; this is why you will find a lot of

@msporleder
msporleder / git-check-hack.sh
Created March 7, 2019 17:03
check for remote changes before running git commands
#!/bin/sh
#git fetch and git checkout always make changes to files in .git
#this causes docker, for example, to uncache the layer if you are putting your source code into the container
branch=${1:-"master"};
repo="git@github.com:foo/bar.git";
#hack to only run git when code is new
cd ./repo_com;
myhash=$(git rev-parse ${branch});
remhash=$(git ls-remote -q ${repo} ${branch}|awk '{ print $1 }');
stage('git') {
dir('pin-manager') {
git branch: params.prj1branch,
credentialsId: 'abc123',
url: 'git@stuff.org:mspo/prj1.git'
}
dir('dev-docker') {
git branch: params.prj2branch,
credentialsId: 'abc123',
url: 'git@stuff.org:mspo/prj2.git'
@msporleder
msporleder / gist:c5b02f6fe0e9668629da8684aed87835
Created August 29, 2018 14:37
apache runtime file contents in headers
#conf.d/set-foo.conf
<If "-f '/var/lib/app/foo.txt'">
SetEnvIfExpr "file('/var/lib/app/foo.txt') =~ /([0-9a-z]+)/" LOCAL-FOO=$1
</If>
#inside of vhost
Header edit Surrogate-Key ^(.*)$ "$1 vhost.com-%{LOCAL-FOO}e" env=LOCAL-FOO
@msporleder
msporleder / erlang-zero.md
Last active October 1, 2017 03:27
step 0 before learning erlang

so you want to learn erlang

erlang is great. It is interesting, fun, cool, everything you want. However, it can be difficult to get started using it because all of the examples are using the interactive shell.

This is a small guide to get a few simple bootstrap things out of the way.

This is not about erlang syntax or idioms, it is how to use it.

getting erlang

#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char *argv[]) {
char *execn;
asprintf(&execn, "%s%s", "--execname=", argv[0]);
/* libpaths need to be generated at perl6 compile time */
char *margs[] = {
execn,
@msporleder
msporleder / THEMETHOD.md
Last active May 10, 2018 16:42
solr recovery: THE METHOD
  1. Ensure there are no tlogs
  2. take backups
  • note the "config name" from tree view for each collection you delete
  • note what the createNodeSet values will be (action=CLUSTERSTATUS&wt=json)
  1. delete everything via collection api
  • repeat until "tree view" in solrcloud admin shows empty collections
  1. shutdown java globally and delete instance dirs if they are still around (they often are)
  2. startup a single node
  3. create collections like so: action=CREATE&name=collection1&shards=shard1,shard2&collection.configName=see-earlier-step&numShards=2&maxShardsPerNode=2&createNodeSet=also-from-info-api
  • you can get createNodeSet value from action=CLUSTERSTATUS&wt=json
<Directory "/var/www/html/fullofhtmls">
Options +MultiViews
AddEncoding x-gzip .gz
<FilesMatch "\.html\.gz">
ForceType text/html
</FilesMatch>
</Directory>
%%fooweb
-module(fooweb_app).
-behaviour(application).
%% Application callbacks
-export([start/2, stop/1]).