Skip to content

Instantly share code, notes, and snippets.

View eduardoaugustojulio's full-sized avatar
🏗️
building

Eduardo Augusto eduardoaugustojulio

🏗️
building
View GitHub Profile
from pyocd.core.helpers import ConnectHelper
from pyocd.flash.loader import FlashLoader
from pyocd.flash.eraser import FlashEraser
from pyocd.flash.file_programmer import FileProgrammer
class ClientOCD():
board = None
target = None
session = None
@eduardoaugustojulio
eduardoaugustojulio / OtlDatetime.h
Last active November 30, 2021 18:31
An inherited class from otl_datime that makes it easy to work with dates in the otlv4 library
#ifndef OTLDATETIME_H
#define OTLDATETIME_H
/*
* abstracao do otl_datetime
*/
#include <iomanip>
#include <otlv4.h>
class OtlDatetime : public otl_datetime
{
#include <stdio.h>
#include <stdlib.h>
int maxDiff(int array[], int n)
{
int maxDiff = 0;
for(int i = 1; i < n; i++)
{
for(int j = 0; j < i; j++)
{
#include <stdlib.h>
#include <stdio.h>
typedef struct SinglyLinkedListNode
{
int data;
SinglyLinkedListNode *next;
}SinglyLinkedListNode;
typedef struct SinglyLinkedList
@eduardoaugustojulio
eduardoaugustojulio / 99-hdmi.audio.sh
Created February 7, 2020 19:44
A simple script thats change the HDMI audio output via udev when detects it's plugged
#!/bin/bash
readonly HDMI_STATUS="/sys/class/drm/card0/*HDMI*/status"
readonly HDMI_DISCONNECTED=$( grep -oq "disconnected" $HDMI_STATUS )
change_sink()
{
local stream="$1"
local stream_id="$( echo "$stream" | cut -f1 )"
@eduardoaugustojulio
eduardoaugustojulio / 99-hdmi.audio.sh
Created February 7, 2020 19:44
A simple script thats change the HDMI audio output via udev when detects it's plugged
#!/bin/bash
readonly HDMI_STATUS="/sys/class/drm/card0/*HDMI*/status"
readonly HDMI_DISCONNECTED=$( grep -oq "disconnected" $HDMI_STATUS )
change_sink()
{
local stream="$1"
local stream_id="$( echo "$stream" | cut -f1 )"
@eduardoaugustojulio
eduardoaugustojulio / read-pipe.sh
Created January 29, 2020 13:44
named pipes example
#!/bin/bash
pipe="pipe"
if [[ ! -p $pipe ]]; then
mkfifo $pipe
fi
while true
do
@eduardoaugustojulio
eduardoaugustojulio / Paciente.java
Created October 1, 2019 13:53
Exercicio de programação java
import java.util.List;
import java.util.Arrays;
import java.util.ArrayList;
public class Paciente{
String nome;
char sexo;
int idade;
@eduardoaugustojulio
eduardoaugustojulio / parallel_curl.sh
Last active September 12, 2019 19:25
A script that runs simultaneously a curl GET command and returns the http status code of a list of addresses.
#!/bin/bash
readonly ARGC=$#
readonly ARGV=( "$@" )
readonly PROG_NAME=$(basename "$0")
usage()
{
echo "Usage: $PROG_NAME <url-list>"
exit 1
@eduardoaugustojulio
eduardoaugustojulio / parallel_ping.sh
Last active September 16, 2019 13:02
A script that pings simultaneously a list of ip addresses.
#!/bin/bash
readonly ARGC=$#
readonly ARGV=( "$@" )
readonly PROG_NAME=$(basename "$0")
usage()
{
echo "Usage: $PROG_NAME <ip-list>"