Skip to content

Instantly share code, notes, and snippets.

View mredar's full-sized avatar

Mark Redar mredar

  • CDL
  • Oakland, CA
View GitHub Profile
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 / 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
@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 / 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 / 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 / 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 / 0_reuse_code.js
Last active August 29, 2015 14:16
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
Setup the tunnel:
ssh -i <identity file for bastion> -L <localport>:<endpoint ip or name>:<endpoint ssh port or other port> <bastion user>@<ssh bastion server>
Then from local machine connect to local port which will be forwarded to endpoint
ssh -i <identity file for endpoint> <endpoint user>@localhost -p <localport from above>
@mredar
mredar / x
Created June 25, 2015 22:54
Collections with missing images for "image" type docs
{
"responseHeader":{
"status":0,
"QTime":112,
"params":{
"facet.query":"true",
"q":"-reference_image_md5:[* TO *]",
"facet.field":"collection_url",
"indent":"true",
"fq":"type_ss:\"image\"",
@mredar
mredar / delete_collection.txt
Created February 17, 2016 22:59
Solr delete query
https://52.10.100.133/solr/dc-collection/update?stream.body=<delete><query>collection_url:"https://registry.cdlib.org/api/v1/collection/26198/"</query></delete>&commit=true