Skip to content

Instantly share code, notes, and snippets.

@hlucasfranca
hlucasfranca / difference.js
Created April 6, 2023 12:16 — forked from Yimiprod/difference.js
Deep diff between two object, using lodash
/**
* Deep diff between two object, using lodash
* @param {Object} object Object compared
* @param {Object} base Object to compare with
* @return {Object} Return a new object who represent the diff
*/
function difference(object, base) {
function changes(object, base) {
return _.transform(object, function(result, value, key) {
if (!_.isEqual(value, base[key])) {
@hlucasfranca
hlucasfranca / Udemy_RemainingTime_Finder.js
Created December 4, 2022 00:42 — forked from jithurjacob/Udemy_RemainingTime_Finder.js
Script to find Udemy Course remaining time
//credits - https://greasyfork.org/en/scripts/28295-udemy-show-section-time
// greasyfonrk was throwing me an error so I created this gist
(function() {
$.getScript("https://greasyfork.org/scripts/5392-waitforkeyelements/code/WaitForKeyElements.js?version=115012", function(){
// waits for the cards to be loaded
waitForKeyElements(selectors.sectionCard, run, true);
});
var selectors = {
sectionCard: 'curriculum-navigation-section',

Here are several different ways to test a TCP port without telnet.

$ cat < /dev/tcp/127.0.0.1/22
SSH-2.0-OpenSSH_5.3
^C

$ cat &lt; /dev/tcp/127.0.0.1/23
from bs4 import BeautifulSoup
attributes = [
"camunda:class",
"camunda:topic",
"camunda:type"
]
with open('process.bpmn', 'r') as f:
@hlucasfranca
hlucasfranca / README.md
Created May 9, 2022 15:43 — forked from IanVaughan/README.md
Push branch from one remote into another

Push branch from one remote into another

Add remote2 as a remote

$ git remote -v
remote2 git@github.com:repo2.git (fetch)
remote2 git@github.com:repo2.git (push)
origin  git@github.com:repo.git (fetch)
origin  git@github.com:repo.git (push)
#-------------------------------------------------------------------------
# FROM: https://kind.sigs.k8s.io/docs/user/local-registry/
set -o errexit
# create registry container unless it already exists
reg_name='kind-registry'
reg_port='5001'
if [ "$(docker inspect -f '{{.State.Running}}' "${reg_name}" 2>/dev/null || true)" != 'true' ]; then
docker run \
@hlucasfranca
hlucasfranca / gist:56b20951825971a650e7369b874185c2
Created March 2, 2022 19:12 — forked from rkbalgi/gist:183a113e946dd9f8360e774dcf17a3db
JDBC_PING with keycloak and postgresql on AWS Fargate
In your effort of implementing standalone-ha with keycloak postgresql using JDBC_PING you will stumble upon many sites that define
the table structure for jgroupsping and the right one goes like this -
CREATE TABLE IF NOT EXISTS JGROUPSPING (
own_addr varchar(200) NOT NULL,
cluster_name varchar(200) NOT NULL,
ping_data BYTEA,
constraint PK_JGROUPSPING PRIMARY KEY (own_addr, cluster_name)
);
@hlucasfranca
hlucasfranca / standalone.xml
Created October 26, 2021 23:33 — forked from skvithalani/standalone.xml
JBoss wildfly, keycloak logs in json format, along with reading the log file location from environment variable
<?xml version='1.0' encoding='UTF-8'?>
<server xmlns="urn:jboss:domain:9.0">
<extensions>
<extension module="org.jboss.as.clustering.infinispan"/>
<extension module="org.jboss.as.connector"/>
<extension module="org.jboss.as.deployment-scanner"/>
<extension module="org.jboss.as.ee"/>
<extension module="org.jboss.as.ejb3"/>
<extension module="org.jboss.as.jaxrs"/>
@hlucasfranca
hlucasfranca / gist:6697ec31f43b9b1b80a0281a136a6b6a
Last active August 20, 2020 07:05 — forked from jdye64/gist:ca07e01ff3d8e93210c3
Convert .dav files in current directory to .mp4
#!/usr/bin/python
print "Converting all of the .dav files in this current directory into .mp4 files using ffmpeg"
import os
from subprocess import call
files = [f for f in os.listdir('.') if os.path.isfile(f)]
for f in files:
ext = f.split(".")[-1]
if ext == "dav" or ext == "DAV":
@hlucasfranca
hlucasfranca / commit-squashing.md
Created March 9, 2020 00:46 — forked from olegchursin/commit-squashing.md
Commit squashing flow
  • Make sure your branch is up to date with the master branch.
  • Run git rebase -i master.
  • You should see a list of commits, each commit starting with the word "pick".
  • Make sure the first commit says "pick" and change the rest from "pick" to "squash". -- This will squash each commit into the previous commit, which will continue until every commit is squashed into the first commit.
  • Save and close the editor (press Esc key, type :w and hit Enter key) -- save a file and quit vim / Vi by pressing Esc key, type :x and hit Enter key.
  • It will give you the opportunity to change the commit message.
  • Save and close the editor again.
  • Then you have to force push the final, squashed commit: git push --force-with-lease origin.