Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View bdmorin's full-sized avatar
👁️‍🗨️
the horrors persist, but so do l

Brian bdmorin

👁️‍🗨️
the horrors persist, but so do l
View GitHub Profile
@bdmorin
bdmorin / great success
Created February 4, 2014 19:02
mailgun = dogemail
Feb 4 13:36:56 184493-devapp1 sendmail[4383]: s14IauDI004383: to=################, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30103, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (s14Iau1m004384 Message accepted for delivery)
Feb 4 13:36:57 184493-devapp1 sendmail[4386]: s14Iau1m004384: to=<################>, ctladdr=<root@184493-devapp1.#########> (0/0), delay=00:00:01, xdelay=00:00:01, mailer=esmtp, pri=120410, relay=gmail-smtp-in.l.google.com. [173.194.77.26], dsn=2.0.0, stat=Sent (OK 1391539017 o4si1543152oei.98 - gsmtp)
Feb 4 13:43:52 184493-devapp1 sendmail[5266]: s14IhpGh005264: to=################, delay=00:00:00, xdelay=00:00:00, mailer=esmtp, pri=128197, relay=aspmx.l.google.com. [173.194.64.26], dsn=2.0.0, stat=Sent (OK 1391539432 z7si12491353oel.77 - gsmtp)
Feb 4 13:43:55 184493-devapp1 sendmail[5269]: s14Ihr2L005267: to=################, delay=00:00:02, xdelay=00:00:02, mailer=esmtp, pri=127115, relay=in1-smtp.messagingengine.com. [66.111.4.72], dsn=2.0.0, st
@bdmorin
bdmorin / nginx_multiple_conditions.conf
Last active April 29, 2016 16:50
My solution for setting multiple conditionals based on several variables in nginx. nginx doesn't allow for nested if statements, if/else, or any advanced logic, so this is what I came up with.
# explain what I'm trying to do
# Given base domain of abc.com
# 1) typical visitor will type in abc.com
# our SEO people want standardized www.abc.com all redirects are 301
# 2) issues in our environment have template assets pointing to
# http://abc.com/skins/some.css
# This makes the browser redirect nearly 15 times, not good.
# 3) We want only the admin area to be https. Due to insecure pixels and other assets
# the rest of the website wouldn't load if it was all https.
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
green='\033[0;32m'
@bdmorin
bdmorin / gist:0688dcb33d4195b6886c
Last active August 29, 2015 14:10
boxes compile errors
We couldn’t find that file to show.
@bdmorin
bdmorin / keybase.md
Created December 4, 2014 23:25
keybase.md

Keybase proof

I hereby claim:

  • I am bdmorin on github.
  • I am bdmorin (https://keybase.io/bdmorin) on keybase.
  • I have a public key whose fingerprint is E2B0 8831 4CCB C8B1 0B00 FF54 003D C629 2BDD 5E0C

To claim this, I am signing this object:

#! /usr/bin/env python3.2
"""
mozreplcurl - Wrapper around curl that adds on firefox's cookies, and updates firefox's cookie db after curl finishes running.
To update firefox's cookies db when firefox is running, mozrepl is required to be installed.
"""
import sys
import re
from telnetlib import Telnet
from argparse import ArgumentParser
@bdmorin
bdmorin / gist:acf12c586b9cda20eb7ac789e0a1a523
Created March 14, 2017 14:00 — forked from jordelver/gist:3073101
Set the Mac OS X SOCKS proxy on the command line

Set the Mac OS X SOCKS proxy on the command line

a.k.a. what to do when your ISP starts blocking sites :(

Set the SOCKS proxy to local SSH tunnel

networksetup -setsocksfirewallproxy "Ethernet" localhost 8080

To clear the domain and port

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AbandonProcessGroup</key>
<true/>
<key>Label</key>
<string>local.automount.sshfs</string>
<key>ProgramArguments</key>
<array>
@bdmorin
bdmorin / reverse_sshfs.md
Created March 23, 2017 21:29
reverse sshfs

2014-07-14 Reverse SSHFS mounts (fs push) https://blog.dhampir.no/content/reverse-sshfs-mounts-fs-push

sshfs is a neat way of mounting a file system from one machine to another over an encrypted ssh channel. However, for machine CLIENT to access a file system that resides on machine HOST, CLIENT must generally be able to log in to HOST. In addition, CLIENT must be able to connect to HOST in the first place, though a tunnel from HOST to CLIENT can easily mediate this if a connection can only be initiated in that direction.

However, the login itself may still be an issue. You might not want to type your password for HOST on CLIENT, or set up a keyless login using public/private keys. You might not entirely trust CLIENT, from which you want to access the file system. dpipe to the rescue.

Using dpipe, available in the “vde2” package on Debian (and, likely, derivatives), you can initiate the connection the other way and use sshfs in “slave mode”, in which it communicates over standard input and output instead o