Skip to content

Instantly share code, notes, and snippets.

View marcoarruda's full-sized avatar
💻
#writting-code

Marco Antonio Arruda marcoarruda

💻
#writting-code
  • Florianópolis, Brazil
View GitHub Profile
@marcoarruda
marcoarruda / hashed_Nodejs.js
Created May 7, 2023 13:34 — forked from Wats0ns/hashed_Nodejs.js
CakePHP Security::Hash in NodeJS
var crypto = require('crypto');
var hash_sha1 = function(password, salt){
password = salt + password;
var hash = crypto.createHash('sha1');
hash.update(password);
var value = hash.digest('hex');
return value;
};
@marcoarruda
marcoarruda / paginator.js
Created April 27, 2023 21:16
Paginator algorithm
// converted to JS from this python solution: https://stackoverflow.com/a/40116188/1408053
const window = 5;
let start = page - window
let end = page + window
if (start <= 0) {
end = end - start + 1
start = 1
}
@marcoarruda
marcoarruda / mov2gif.sh
Created November 1, 2022 15:14
Convert .mov to .gif
#!/bin/bash
export INPUT="${1}"
echo $INPUT
export OUTPUT="${2}"
echo $OUTPUT
if [ ! -f "$INPUT" ]
then
echo "File $INPUT does not exists"
@marcoarruda
marcoarruda / delete_git_submodule.md
Created August 2, 2018 17:48 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@marcoarruda
marcoarruda / rospy_publisher.py
Created November 6, 2017 11:46
Rospy publisher
import rospy
from std_msgs.msg import String
pub = rospy.Publisher('topic_name', String, queue_size=10)
rospy.init_node('node_name')
r = rospy.Rate(10) # 10hz
while not rospy.is_shutdown():
pub.publish("hello world")
r.sleep()
@marcoarruda
marcoarruda / turtlebot_mode.cpp
Last active August 28, 2017 12:43
Move a certain distance, turn, then move (Odometry topic)
#include <ros/ros.h>
#include <tf/tf.h>
#include <geometry_msgs/Twist.h>
#include <geometry_msgs/Pose2D.h>
#include <nav_msgs/Odometry.h>
#include <math.h>
geometry_msgs::Pose2D current_pose;
ros::Publisher pub_pose2d;
@marcoarruda
marcoarruda / conversion_node.cpp
Last active June 27, 2024 20:26
ROS Quaternion to RPY
#include <tf/tf.h>
#include <nav_msgs/Odometry.h>
#include <geometry_msgs/Pose2D.h>
ros::Publisher pub_pose_;
void odometryCallback_(const nav_msgs::Odometry::ConstPtr msg) {
geometry_msgs::Pose2D pose2d;
pose2d.x = msg->pose.pose.position.x;
pose2d.y = msg->pose.pose.position.y;