Skip to content

Instantly share code, notes, and snippets.

@akafael
akafael / stackingPlots.m
Last active December 9, 2018 22:28
Matlab stacking plots example
%% STACKPLOT
% Stacking two plots example from https://stackoverflow.com/questions/11757987/matlab-stacking-of-various-plots
%% Data
t = 0:100;
f1 = 0.3;
f2 = 0.07;
u1 = sin(f1*t); cu1 = 'r'; %red
u2 = cos(f2*t); cu2 = 'b'; %blue
v1 = 5*u1.^2; cv1 = 'm'; %magenta
@akafael
akafael / rosbag-python-ctrl.py
Created July 27, 2018 14:55
Sample Script for controling rosbag process
# Sample Script for controling rosbag process
# ref: https://answers.ros.org/question/10714/start-and-stop-rosbag-within-a-python-script/?answer=223617#post-id-223617
def terminate_process_and_children(p):
import psutil
process = psutil.Process(p.pid)
for sub_process in process.get_children(recursive=True):
sub_process.send_signal(signal.SIGINT)
p.wait() # we wait for children to terminate
p.terminate()
@akafael
akafael / i3wm_keyboard.config
Created June 9, 2018 18:52
i3wm Keyboard Layout toogle shortcut
# i3wm Keyboard Layout toogle
bindsym $mod+space "exec setxkbmap -query | grep us && setxkbmap -layout br || setxkbmap -layout us"
@akafael
akafael / example.desktop
Last active February 2, 2018 00:10
DesktopLinksOnLinux
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Name=MyProgramName
GenericName= My Complete Program Name
Exec= /path/to/my/program.sh
Icon=/path/to/my/program/icon.png
Terminal=true
StartupWMClass=MyProgramGroupClass
Type=Application
@akafael
akafael / kb-light.py
Created December 13, 2017 13:49
Control Keyboard Light using dbus
#!/usr/bin/env python3
# coding: utf-8
##
# Control keyboard backlight
##
from sys import argv
import dbus
@akafael
akafael / playDigimon.py
Created October 12, 2017 13:17
[Digimon Word 3 - PS1] Farming XP Script
#!/bin/python
##
# Digimon Word 3 - Farming XP Script
# @version 1.0 - Open Loop Movement
##
import time
import pyautogui
@akafael
akafael / hideButton.html
Created August 6, 2017 23:09
Tougle Hide Button for ipython code cells
<!-->
Hide Button for code
Put as part of a markdown cell
</!-->
<script>
function code_toggle() {
if (code_shown){
$('div.input').hide('500');
$('#toggleButton').val('Show Code')
@akafael
akafael / mipsInstructionCounter.sh
Created June 21, 2017 11:43
Contador de Instruções para estudo de Complexidade de Algoritmo implementado no Mars Mips
#!/bin/bash
MARS_MIPS="/opt/mars_mips/Mars45_Custom4.jar"
INDEX=0;
MAX_INDEX=19;
PROGRAM='primeNumbers.s'
OUT="Index,IC"
@akafael
akafael / pdf_tools.md
Created April 3, 2017 12:38
PDF Tools on Linux

PDF Tools on Linux

Extract Images from PDF file

using pdfimages [1]

$ pdfimages -j myDocument.pdf /my/outputfile/
@akafael
akafael / linksOnLinux.md
Created December 3, 2016 16:53
[Tutorial] Create a link on Linux

How to create a link on Linux

1. Create a file with extention .desktop whith the following content

$ gedit myProgram.desktop

Content: