Skip to content

Instantly share code, notes, and snippets.

@atomass
atomass / pdfunlock.sh
Created December 10, 2018 13:39
PDF password unlock
#!/bin/bash
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color
echo -n "PDF Password: " && read -s && echo "" && qpdf --password=$REPLY --decrypt "$1" "$2" && echo -e "${GREEN}DONE${NC}" || echo -e "${RED}FAILED${NC}"
@atomass
atomass / qtcpsocket_test.cpp
Created June 27, 2018 13:29
QTcpSocket with specific source/local port
// UNIX includes
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <errno.h>
#include <string.h>
// QT includes
#include <QCoreApplication>
@atomass
atomass / JSONHelper.h
Last active May 25, 2018 14:41
Serialize QObject derived class into QJsonDocument
#ifndef JSONHELPER_H
#define JSONHELPER_H
#include <QJsonObject>
#include <QMetaProperty>
class JSONHelper
{
public:
template<class T>