Skip to content

Instantly share code, notes, and snippets.

View jgfaisca's full-sized avatar
🎯
Focusing

jgfaisca

🎯
Focusing
  • Lisbon, Portugal
View GitHub Profile
@jgfaisca
jgfaisca / test-ssl-client-auth.txt
Created October 27, 2023 01:55
Testing SSL/TLS Client Authentication with openssl
#
# Testing SSL/TLS Client Authentication with openssl
#
# Create a test file
echo "Hello!" > test.txt
# Setup an SSL/TLS server that checks the client certificate
openssl s_server -cert server-cert.pem -key server-key.pem -WWW -port 4433 -CAfile ca-cert.pem -verify_return_error -Verify 1
@jgfaisca
jgfaisca / keybase.md
Created October 11, 2019 09:40
Keybase proof

Keybase proof

I hereby claim:

  • I am jgfaisca on github.
  • I am jgfaisca (https://keybase.io/jgfaisca) on keybase.
  • I have a public key whose fingerprint is 3745 D578 1828 A3B2 BC29 605A 8647 7DC0 A2C6 E081

To claim this, I am signing this object:

@jgfaisca
jgfaisca / timer-url.sh
Last active March 18, 2019 11:33
Using watch command to start a timer url
#!/bin/bash
#
# Using watch command to start a timer url
#
# MacOS
# -----
# watch -n <seconds> open -a <app_name> <url>
#
# Dependencies:
# $ brew install watch
0xaf252776BaE2D3748b6897784769FE22501e4b79
@jgfaisca
jgfaisca / gist:5715a8d097eefdc6d4e97da4d8db8edc
Created October 16, 2017 09:17
Start a stopped Docker container with a different command
Find your stopped container id:
$ docker ps -a
Commit the stopped container:
This command saves modified container state into a new image user/test_image
$ docker commit $CONTAINER_ID user/test_image
Start/run with a different entry point:
$ docker run -ti --entrypoint=sh user/test_image
@jgfaisca
jgfaisca / gist:65cb031e4b00c656d240cb0be48c7af8
Created October 15, 2017 23:29
Docker: remove all exited containers
docker rm $(docker ps --all -q -f status=exited)
@jgfaisca
jgfaisca / gist:62c28574095e1f5cf38131c0c305daff
Created September 24, 2016 23:49
List opened files based on process names
lsof -c <process_name>
You can give multiple -c switch on a single command line, example:
lsof -c ssh -c init
@jgfaisca
jgfaisca / gist:e74c50330d1114f3fe3a8dd918359fee
Created September 24, 2016 12:17
Find the largest top 10 files and directories on a Linux / UNIX / BSD home directory (include hidden files/directories)
du -sch $HOME/.[!.]* * | sort -rh | head -10
@jgfaisca
jgfaisca / gist:f8a7910310fa4c630518298042abbbf3
Created September 10, 2016 21:24
Hosting a simple static site on IPFS
Add a TXT record to DNS <domain> with:
dnslink="/ipns/<PeerID>"
example
dnslink="/ipns/QuVGb9PpmLb1TwsMkE1b8jVK8LGceMYMsWaSSviSucWPGx"
@jgfaisca
jgfaisca / example-sparqlwraper-dbpedia.py
Created September 10, 2016 21:12
SPARQLWrapper DBpedia example
#!/usr/bin/python
# -*- coding: utf-8 -*-
from SPARQLWrapper import SPARQLWrapper, JSON, XML, N3, RDF
sparql = SPARQLWrapper("http://dbpedia.org/sparql")
sparql.setQuery("""
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?wikiPageRevisionID
WHERE {<http://dbpedia.org/resource/Asturias> dbo:wikiPageRevisionID ?wikiPageRevisionID }