Skip to content

Instantly share code, notes, and snippets.

@carlosolmos
carlosolmos / noise_filtering-corrected.ipynb
Last active March 20, 2023 14:48
noise_filtering-corrected.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@carlosolmos
carlosolmos / noise_filtering.ipynb
Created March 20, 2023 07:32
noise_filtering.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
nc {IP} {port} | hexdump -e '16/1 "%0.2x " "\n" 1/1 "%0.2x " "\n"'
@carlosolmos
carlosolmos / github_to_bitbucket
Created September 18, 2018 20:51
github_to_bitbucket
Go to Bitbucket and create a new repository (its better to have an empty repo)
git clone [email protected]:abc/myforkedrepo.git
cd myforkedrepo
Now add Github repo as a new remote in Bitbucket called "sync"
git remote add sync [email protected]:def/originalrepo.git
Verify what are the remotes currently being setup for "myforkedrepo". This following command should show "fetch" and "push" for two remotes i.e. "origin" and "sync"
git remote -v
@carlosolmos
carlosolmos / opentsdb_stats_jq_filter.sh
Created September 10, 2018 17:00
get opentsdb stats and filter with jq
curl http://opentsdb.servicelocal:4242/api/stats | jq '.[] | select(.metric == "tsd.rpc.received")'
@carlosolmos
carlosolmos / backgroundoutputredirect.sh
Created September 4, 2018 17:53
Redirect command output while on background
some_cmd > some_file 2>&1 &
@carlosolmos
carlosolmos / parseAwsCloudWatchLogs.sh
Created August 30, 2018 17:23
[Parse AWS Logs] example of how to parse aws cloudwatch logs
#Requirements:
# aws cli
# jq
aws logs get-log-events --log-group-name LOGGROUP --log-stream-name STREAMID \
--limit 100 | jq '.events | .[] | .message' | \
awk '{printf "%s:%s\t->\t%s:%s\n", $4, $6, $5, $7}'
@carlosolmos
carlosolmos / socketserver.cpp
Created May 15, 2018 03:28
QT Socket Server
/*
The server extends QTcpServer
*/
SocketServer::SocketServer(QObject *parent) : QTcpServer(parent)
{
}
//Method to start listening for connections in a given port and range of remote addresses:
//QHostAddress::LocalHost only accepts connections from localhost
//QHostAddress::Any accepts connections from anywhere.
@carlosolmos
carlosolmos / socketclient.cpp
Created May 14, 2018 05:30
QT. Socket Client.
/*
Connecting to a TCP socket server.
*/
//Create the socket object.
QTcpSocket *socket = new QTcpSocket(this);
//tap into the socket signals with some local methods.
//status signals
connect(socket, SIGNAL(connected()), this, SLOT(connected()));
@carlosolmos
carlosolmos / redirectQDebug.cpp
Last active November 15, 2023 03:52
Redirect QDebug output to a file.
/*
This code redirects the output of qDebug() to a log file.
It also rotates the file base on size.
Uses QMutex for thread safety.
*/
//some constants to parameterize.
const qint64 LOG_FILE_LIMIT = 3000000;
const QString LOG_PATH = "/application/logs/";
const QString LOG_FILENAME = "mylogfile.log";