This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### 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: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 + "." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const rp = require('request-promise'); | |
go() | |
function go() { | |
var options = { | |
uri: 'https://jsonplaceholder.typicode.com/todos/1', | |
json: true | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |