Skip to content

Instantly share code, notes, and snippets.

View cr-solutions's full-sized avatar

Ricardo Cescon cr-solutions

View GitHub Profile
@midom
midom / topwaits.py
Created July 2, 2020 17:11
stall detector!
#!/usr/bin/env bcc-py
#
# topwaits Show longest off-cpu waits per-stack
#
# Copyright 2019 Facebook, Inc.
# Copyright 2016 Netflix, Inc.
# Licensed under the Apache License, Version 2.0 (the "License")
#
# 13-Jan-2016 Brendan Gregg Wrote offcpu profiler
# 27-Nov-2019 Domas Mituzas Gutted most of profiling part and left stall detector
@bradennapier
bradennapier / recursive-install.js
Last active December 7, 2023 15:44
Recursively find and install dependencies in subdirectories
const path = require('path');
const { promises: fs } = require('fs');
const cp = require('child_process');
/*
Recursively iterates and finds subdirectories which have a `package.json` file and does a dependency installation based
on the given configuration.
- can be setup to use yarn or npm
- can be setup to determine the command to use based on lock files so that if you set it to use yarn but a directory only
@lamak-qaizar
lamak-qaizar / redis-slowlog-pretty-printer.py
Last active November 27, 2020 07:47
Redis SLOWLOG pretty printer with formatted timestamps
# 1. Requirements:
# python3.6, redis-py
# 2. Run instructions:
# python redis-slowlog-pretty-printer.py <redis endpoint> <port> <# logs to get>
# eg. python redis-slowlog-pretty-printer.py localhost 6379 10
# 3. Sample output:
# <local date/time> [ <execution time> ]: <command>
# 2017-06-22 00:00:00 [ 10.0 s ]: b'keys *rk54jhk345hnmmlk4lk*'
@corbanb
corbanb / pre-request-jwt.js
Last active February 21, 2024 14:47
JWT tokenize - Postman Pre-Request Script
function base64url(source) {
// Encode in classical base64
encodedSource = CryptoJS.enc.Base64.stringify(source);
// Remove padding equal characters
encodedSource = encodedSource.replace(/=+$/, '');
// Replace characters according to base64url specifications
encodedSource = encodedSource.replace(/\+/g, '-');
encodedSource = encodedSource.replace(/\//g, '_');
@csonuryilmaz
csonuryilmaz / clone-mysql-db.sh
Last active May 17, 2024 12:12 — forked from christopher-hopper/clone-mysql-db.sh
Clone a MySQL database to a new database on the same server without using a dump file. This is much faster than using mysqldump.
#!/bin/bash
DBUSER="root";
DBPASS="";
DBHOST="localhost";
DB_OLD=mydatabase
DB_NEW=clone_mydatabase
DBCONN="--host=${DBHOST} --user=${DBUSER} --password=${DBPASS}";
@ziadoz
ziadoz / install.sh
Last active April 20, 2024 10:18
Install Chrome, ChromeDriver and Selenium on Ubuntu 16.04
#!/usr/bin/env bash
# https://developers.supportbee.com/blog/setting-up-cucumber-to-run-with-Chrome-on-Linux/
# https://gist.github.com/curtismcmullan/7be1a8c1c841a9d8db2c
# https://stackoverflow.com/questions/10792403/how-do-i-get-chrome-working-with-selenium-using-php-webdriver
# https://stackoverflow.com/questions/26133486/how-to-specify-binary-path-for-remote-chromedriver-in-codeception
# https://stackoverflow.com/questions/40262682/how-to-run-selenium-3-x-with-chrome-driver-through-terminal
# https://askubuntu.com/questions/760085/how-do-you-install-google-chrome-on-ubuntu-16-04
# Versions
CHROME_DRIVER_VERSION=`curl -sS https://chromedriver.storage.googleapis.com/LATEST_RELEASE`
@adamreisnz
adamreisnz / package.json
Last active January 19, 2024 13:01
Simple pure npm scripts build process
{
"name": "project-name",
"description": "Template for static sites",
"version": "1.0.0",
"homepage": "http://www.project-name.com",
"author": {
"name": "Adam Reis",
"url": "http://adam.reis.nz"
},
"license": "UNLICENSED",
@noelboss
noelboss / git-deployment.md
Last active May 16, 2024 20:41
Simple automated GIT Deployment using Hooks

Simple automated GIT Deployment using GIT Hooks

Here are the simple steps needed to create a deployment from your local GIT repository to a server based on this in-depth tutorial.

How it works

You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like deepl.io to act upon a Web-Hook that's triggered that service.

@anubhavsinha
anubhavsinha / cwl.sh
Created October 31, 2015 18:46
send events to a stream in a log group in cloudwatch - for elastic search
aws logs put-log-events --log-group-name anubhav-PoC --log-stream-name anubhav-PoC --log-events "[{\"timestamp\":`date +%s%3N`, \"message\": \"Simple ElasticSearch Test\"}]"
@thanosa75
thanosa75 / find_in_redis.sh
Last active March 4, 2022 05:49
Example of SCAN / COUNT looking for patterns in REDIS
#!/bin/bash
# sample code demonstrating a pattern search with SCAN
# using a COUNT "work intent"
if [ $# -ne 3 ]
then
echo "Find matching a pattern using SCAN "
echo "Usage: $0 <host> <port> <pattern>"
exit 1