Skip to content

Instantly share code, notes, and snippets.

View mredar's full-sized avatar

Mark Redar mredar

  • CDL
  • Oakland, CA
View GitHub Profile
@mredar
mredar / certutil-note
Last active August 29, 2015 14:14
Certutil to install self-signed cert on linux
Install self-signed cert in chromium on linux:
then you don't get complaints, will if it changes (MOTM attack?)
First, click on broken https in address bar & export certificate as a .der file
certutil -d sql:$HOME/.pki/nssdb -A -t "P,," -n <cert nickname> -i <cert file>
@mredar
mredar / delay_decorator.py
Created October 28, 2014 19:46
Delay decorator for "nicing" server downloads
import datetime
import time
def pause_2b_nice(func):
'''Pause the execution for however long func took to run.
Useful for not overloading servers when downloading assets.
'''
def inner(*args, **kwargs):
dt_start = dt_end = datetime.datetime.now()
ret = func(*args, **kwargs)
@mredar
mredar / vagrant-tips
Created October 24, 2014 17:47
Vagrant gotchas
For a provisioner to work, it must be installed on the local system. with ansible provisioner, need to ansible-playbook on local system
@mredar
mredar / nsenter_cmd
Created October 20, 2014 23:53
nsenter to attach to running docker
PID==$(docker inspect --format '{{.State.Pid}}' my_container_id)
nsenter --mount --uts --ipc --net --pid --target $PID
@mredar
mredar / port-forward
Created October 10, 2014 17:45
Port forwarding service script
#! /bin/sh
### BEGIN INIT INFO
# Provides: portforwarding
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Description: Start port redirection
### END INIT INFO
HTML/CSS tricks
from: https://www.quora.com/Web-Development/What-are-the-most-interesting-HTML-JS-DOM-CSS-hacks-that-most-web-developers-dont-know-about
different node depth colors, for identifying layouts on page
* { background-color: rgba(255,0,0,.2); }
* * { background-color: rgba(0,255,0,.2); }
* * * { background-color: rgba(0,0,255,.2); }
* * * * { background-color: rgba(255,0,255,.2); }
* * * * * { background-color: rgba(0,255,255,.2); }
@mredar
mredar / aws-tips.rst
Last active August 29, 2015 14:05
AWS Tips

AWS Tips

EC2

To enable NAT function, you must DISABLE Source/Destination Check to let this happen.

Resize EBS volume

@mredar
mredar / ansible-ec2-tips
Last active August 29, 2015 14:04
ec2 ansible tips
never use ec2 - exact_count paramter. This TERMINATED all the running instances except for exact_count number. This can have disatirous results, i hammered the whole cdlib dsc archivesspace server setup in AWs with this option. TODO: NEEDS to be noted in the options docs on this exact_count param.
use stete: present to create a new instance
not sure what state: running causes
always disable api termination
set to NOT DELETE on termination on ALL VOULUMES
TODO: REBUILD FROM SCRATCH: FRONT END WITH APACHE PROXY (due to nginx mangling of paths see: apache directive = <TODO: lookup>
@mredar
mredar / DockerStartLinks
Last active August 29, 2015 14:03
Links for Docker quick start
@mredar
mredar / smtpd-run.py
Created May 1, 2014 00:22
Python stdlib smtpd server, for dev envs
import smtpd
import asyncore
d=smtpd.DebuggingServer(('127.0.0.1', 25), None)
try:
asyncore.loop()
except KeyboardInterrupt:
pass