Skip to content

Instantly share code, notes, and snippets.

View r-trigo's full-sized avatar
📚
Learning to share

Rui Trigo r-trigo

📚
Learning to share
View GitHub Profile
### Keybase proof
I hereby claim:
* I am r-trigo on github.
* I am rtrigo (https://keybase.io/rtrigo) on keybase.
* I have a public key ASChsKL7Eh4bceu-4cV9p2I301qvwWO8bq7Y-aiVdstWYwo
To claim this, I am signing this object:
@r-trigo
r-trigo / sentence-split.py
Last active May 1, 2020 20:21
Python split() recreation
#!/usr/bin/env python3
# obter um array com as palavras da frase
print("Escreva a frase a fragmentar:")
frase = input()
palavras = []
# se nao tiver ponto final passa a ter
if len(frase) != ".":
frase = frase + "."
@r-trigo
r-trigo / resume.json
Last active January 26, 2025 22:32 — forked from thomasdavis/resume.json
JSON Resume
{
"basics": {
"name": "Rui Trigo",
"label": "Senior Site Reliability Engineer",
"picture": "https://pbs.twimg.com/profile_images/1289318030003109899/muL9ubdE_400x400.jpg",
"email": "[email protected]",
"website": "https://r-trigo.github.io",
"summary": "Computer engineer and Mobile Computing master. Graduated from Escola Superior de Tecnologia e Gestão of Instituto Politécnico da Guarda. AWS (Solutions Architect), Cisco (CCNA and CCNA Security), Hashicorp (Terraform Associate), Kubernetes (CKA) and Linux certified (Linux essentials and LPIC-1). Passioned by martial arts and using technology in order to improve the world. Also loves a good get-together. Computer experience started in 2009.",
"location": {
"city": "Porto",
@r-trigo
r-trigo / index.js
Created June 14, 2019 08:42
Chaining HTTP requests with request-promise package
const rp = require('request-promise');
go()
function go() {
var options = {
uri: 'https://jsonplaceholder.typicode.com/todos/1',
json: true
};
public Bitmap LoadImageFromWeb(String url) {
url = "https:" + url;
Bitmap bmp = null;
URL[] myURL = new URL[1];
try {
myURL[0] = new URL(url);
bmp = BitmapFactory.decodeStream((InputStream) myURL[0].getContent());
} catch (IOException e) {
e.printStackTrace();
}
@r-trigo
r-trigo / passenger.80.log
Created April 7, 2017 11:35
My passenger log file
[ 2017-04-07 11:51:05.8908 14234/76f37000 age/Wat/WatchdogMain.cpp:1281 ]: Starting Passenger watchdog...
[ 2017-04-07 11:51:05.9507 14237/76fea000 age/Cor/CoreMain.cpp:1070 ]: Starting Passenger core...
[ 2017-04-07 11:51:05.9516 14237/76fea000 age/Cor/CoreMain.cpp:245 ]: Passenger core running in multi-application mode.
[ 2017-04-07 11:51:06.0161 14237/76fea000 age/Cor/CoreMain.cpp:820 ]: Passenger core online, PID 14237
[ 2017-04-07 11:51:06.0795 14246/76fad000 age/Ust/UstRouterMain.cpp:529 ]: Starting Passenger UstRouter...
[ 2017-04-07 11:51:06.0829 14246/76fad000 age/Ust/UstRouterMain.cpp:342 ]: Passenger UstRouter online, PID 14246
[ 2017-04-07 11:51:08.8851 14237/75fff430 age/Cor/SecurityUpdateChecker.h:464 ]: Security update check: no update found (next check in 24 hours)
App 14284 stdout:
App 14284 stderr: /var/www/demo/code/vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.1/lib/active_support/core_ext/numeric/conversions.rb:121: warning: constant ::Fixnum is deprecated
App 14284 stderr: /var/www/de
//Sending a POST request
public int SendThisByPOST(URL myURL, JSONObject params) {
HttpURLConnection conn = null;
DataOutputStream output;
int response = 0;
try {
conn = (HttpURLConnection) myURL.openConnection();
conn.setRequestMethod("POST");
//To perform an HTTP PUT:
URL url = new URL("http://www.example.com/resource");
HttpURLConnection httpCon = (HttpURLConnection) url.openConnection();
httpCon.setDoOutput(true);
httpCon.setRequestMethod("PUT");
OutputStreamWriter out = new OutputStreamWriter(
httpCon.getOutputStream());
out.write("Resource content");
out.close();
private class LoadImageTask extends AsyncTask<String, Void, Bitmap> {
@Override
protected Bitmap doInBackground(String... image_url) {
URL[] myURL = new URL[1];
try {
myURL[0] = new URL(image_url[0]);
return BitmapFactory.decodeStream((InputStream) myURL[0].getContent());
} catch (IOException e) {
e.printStackTrace();
@r-trigo
r-trigo / sql
Last active February 9, 2017 17:50
Regexp_substr for ids_array in varchar2
SELECT regexp_substr('[1,2,3,4,5,6]', '[^],]+', 2, level) AS id_filmes
FROM dual
CONNECT BY regexp_substr('[1,2,3,4,5,6]', '[^],]+', 2, level) IS NOT NULL;
com variável:
SELECT regexp_substr(p_ids_filmes, '[^],]+', 2, level) AS id_filmes
FROM dual
CONNECT BY regexp_substr(p_ids_filmes, '[^],]+', 2, level) IS NOT NULL;