Skip to content

Instantly share code, notes, and snippets.

View raulperula's full-sized avatar

Raúl Pérula Martínez raulperula

View GitHub Profile
@raulperula
raulperula / show_services.py
Created October 4, 2016 16:56
Script to show current services running in ROS. Similar to get_published_topics() implemented function in rospy.
import rosgraph.masterapi
m = rosgraph.masterapi.Master('/my_node')
services = m.getSystemState()[2]
service_names = [x[0] for x in services]
print (service_names)
grep -R "<string to find>" <path>
# revert a file
git checkout -- filename
# pull changes maintaining local changes
git stash
git pull
git stash pop
# Changing a remote's URL
https://help.github.com/articles/changing-a-remote-s-url/
@raulperula
raulperula / README.me
Created March 10, 2017 11:52
How do I save terminal output to a file?
To write the output of a command to a file, there are basically 10 commonly used ways.
Please note that the n.e. in the syntax column means "not existing".
There is a way actually, but it's too complicated to fit into the column. You can find a helpful link in the List section about it.
Overview:
|| visible in terminal || visible in file || existing
Syntax || StdOut | StdErr || StdOut | StdErr || file
==========++==========+==========++==========+==========++===========
# remove last word
Ctrl + w
# remove all words
Ctrl + u
@raulperula
raulperula / pip_install_e
Created August 28, 2017 11:41
Automatically create requirements.txt (pip)
pip freeze > requirements.txt
@raulperula
raulperula / compile_pyfile
Created December 18, 2017 12:17
Compile Python files
python -m compileall <file_1>.py <file_n>.py
@raulperula
raulperula / echo_command
Created March 26, 2018 09:15
execute command continuously in terminal
watch -n0 <command>
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain system -domain user
@raulperula
raulperula / loteria.sh
Created December 16, 2021 14:23 — forked from jfisbein/loteria.sh
Script para chequear numeros loteria de navidad usando api de El Pais
#!/usr/bin/env bash
# Script to check Spanish Christmas Lottery
# more info: https://servicios.elpais.com/sorteos/loteria-navidad/api/
AUTO_RELOAD="120" # seconds
declare -A mainPrizes
mainPrizes['numero1']='1er Premio'
mainPrizes['numero2']='2º Premio'