Skip to content

Instantly share code, notes, and snippets.

@damaya
damaya / gist:f67885b25c34299085e9
Created August 6, 2015 19:40
Grep users connected to server by ssh
lsof -i TCP -P | grep ssh
@damaya
damaya / gist:86d8de23f29f5f942da2
Created August 14, 2015 16:10
Escape slash in vim replace
:%s/\//-/g
@damaya
damaya / gist:0333e39f540ce9ff5d6f
Created September 4, 2015 04:05
some sed and vim replace queries
Replace only last ocurrence
:s/.*\zsts server thread txn_id txn_time user hostname ip db tbl idx lock_type lock_mode wait_hold victim query//
Replace with seed
sed 's/ts server thread txn_id txn_time user hostname ip db tbl idx lock_type lock_mode wait_hold victim query/<replacewiththis>/g' newdeadlock.log > changedeadlock.log
https://github.com/symfony/security-bundle/blob/master/Resources/config/security.xml
@damaya
damaya / postgre inyect
Created February 14, 2017 12:51
Operaciones postgre
1. Log into postgre: sudo su - postgres
2. create db: createdb newdb
3. Inyect db psql worlddb < world.sql
---
Ingres to specific db, specific user
psql --username=awx --password --dbname=awx
Dumb database
pg_dump --username=awx --password --dbname=awx > /tmp/awx-tower.sql
[program:hubot]
command=/usr/bin/coffee node_modules/.bin/hubot --name ozux --adapter slack
directory=/usr/local/bot/hubot.ozux-bot
stdout_logfile=/var/log/%(program_name)s-stout.log
stderr_logfile=/var/log/%(program_name)s-stderr.log
stdout_logfile_backups=10
stderr_logfile_backups=10
user=ubuntu
startsecs=10
autorestart=true
Procedure
Take the file you exported (e.g. certname.pfx) and copy it to a system where you have OpenSSL installed. Note: the *.pfx file is in PKCS#12 format and includes both the certificate and the private key.
Run the following command to export the private key: openssl pkcs12 -in certname.pfx -nocerts -out key.pem -nodes
Run the following command to export the certificate: openssl pkcs12 -in certname.pfx -nokeys -out cert.pem
Run the following command to remove the passphrase from the private key: openssl rsa -in key.pem -out server.key
@damaya
damaya / gist:8eeab3c7b7b22741d896a6c50b7008ed
Created August 29, 2017 12:48
Check openssl connection between machines
https://www.cyberciti.biz/faq/test-ssl-certificates-diagnosis-ssl-certificate/
@damaya
damaya / gist:cd5fcd91a88e18b56e14cdf7e6722c9a
Last active August 21, 2018 22:44
Using overblog for graphql with star wars example
From Resources/config/graphql/Query.types.yml
human:
type: "Human"
args:
id:
description: "id of the human"
type: "String!"
resolve: "@=resolver('character_human', [args])"
droid:
type: "Droid"
<If "%{HTTP_HOST} == 'www.domain.com.co'">
RedirectMatch 301 (?i)/matchpart http://anyotherdomain.co/path
</If>
Check https://perishablepress.com/case-insensitive-redirectmatch/