Skip to content

Instantly share code, notes, and snippets.

View whomwah's full-sized avatar

Duncan Robertson whomwah

View GitHub Profile
@whomwah
whomwah / gist:6068816
Last active April 11, 2019 07:35
[lsof] Check if port is being used #bash
# Run this command
lsof -i :3000
~/_dev/kyan/project(kyan_rails_3_2_13_upgrade) $ lsof -i :3000
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
ruby 8511 duncan 15u IPv4 0xf8ff7ea926138439 0t0 TCP *:hbci (LISTEN)
# kill the rogue PID
kill 8511
@whomwah
whomwah / README.md
Last active April 11, 2019 07:44
[git] #git

creating a zip from a git archive

git archive HEAD --format=zip > archive.zip

@whomwah
whomwah / gist:2018051
Last active April 11, 2019 08:06
xattr OSX privs

Use the xattr command. You can inspect the extended attributes:

$ xattr s.7z
com.apple.metadata:kMDItemWhereFroms
com.apple.quarantine
and use the -d option to delete one extended attribute:

$ xattr -d com.apple.quarantine s.7z
$ xattr s.7z
@whomwah
whomwah / gist:1835613
Last active April 11, 2019 08:07
[mysql] Adding and removing Mysql privileges #mysql

add privs

grant all on database.* to 'wl'@'10.10.12.111' identified by 'password';

remove privs

revoke all on database.* from 'wl'@'10.10.12.111';

@whomwah
whomwah / README.md
Last active April 11, 2019 08:10
[Nginx] #nginx

Simple example of passing a short domain name over to a long one. Useful when url shortening

<VirtualHost *:80>
    ServerName short.me
    ServerAlias www.short.me
    ProxyPass / http://myverylongdomainname.com/
</VirtualHost>
@whomwah
whomwah / gist:1753130
Last active April 11, 2019 08:10
Converting .p12 certs to .pem #unix
$ openssl pkcs12 -nodes -in /path/to/my/cert.p12 -out /pathto/my/cert.pem
@whomwah
whomwah / keybase.md
Last active April 11, 2019 08:11
[Keybase] #ssh

Keybase proof

I hereby claim:

  • I am whomwah on github.
  • I am whomwah (https://keybase.io/whomwah) on keybase.
  • I have a public key whose fingerprint is B08A 48C6 5AAB 9463 8B53 11D0 A216 9097 FE9D 4B5B

To claim this, I am signing this object:

@whomwah
whomwah / README.md
Last active April 11, 2019 08:13
[RegExp] Various useful regex's #regex

Must include one number, one upper and lower case letter and be between 8 and 40 characters

/^(?=.*\d)(?=.*?[a-z])(?=.*?[A-Z]).{8,40}$/

@whomwah
whomwah / generate_csr
Last active April 11, 2019 08:14
[Unix Certs] Generating CSR request, installing SSL cert and configuring Nginx on ubuntu 12.04LTS #ssl #certs
cd /etc/ssl
openssl req -nodes -newkey rsa:2048 -keyout domain.key -out domain.csr
Generating a 2048 bit RSA private key
.................................................................................+++
........................+++
writing new private key to 'domain.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
@whomwah
whomwah / Dockerfile
Last active April 11, 2019 08:19
[Legacy Ruby Docker] Simple Dockerfile that does legacy Ruby, for Rails Apps #docker
FROM ubuntu:16.04
MAINTAINER john@doe.com
ENV REFRESHED_AT 2016-07-27
# Choose your ruby version
ENV RUBY_VERSION 'ruby 2.2'
# Install packages
RUN apt-get update && apt-get -y install wget \
build-essential \