Skip to content

Instantly share code, notes, and snippets.

View danielgospodinow's full-sized avatar
🔊
I convert chalga to code

Daniel Gospodinow danielgospodinow

🔊
I convert chalga to code
View GitHub Profile
@danielgospodinow
danielgospodinow / unique-ids-from-second-file.py
Created February 19, 2024 07:45
Get CAN IDs present only in the second file, log also the number of their occurances
import sys
import collections
def extract_ids(filename):
with open(filename, "r") as file:
return [line.split()[2].split("#")[0] for line in file]
def count_ids(filename):
@danielgospodinow
danielgospodinow / robbyrussell.zsh-theme
Created January 11, 2024 07:20
Fork of oh-my-zsh's `robbyrussell` theme
PROMPT="%(?:%{$fg_bold[green]%}%1{➜%} :%{$fg_bold[red]%}%1{➜%} ) %{$fg[cyan]%}%d%{$reset_color%}"
PROMPT+=' $(git_prompt_info)'
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}%1{*%}"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%}"
hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000035,"HIDKeyboardModifierMappingDst":0x700000035},{"HIDKeyboardModifierMappingSrc":0x700000064,"HIDKeyboardModifierMappingDst":0x700000064}]}'
hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000035,"HIDKeyboardModifierMappingDst":0x700000064},{"HIDKeyboardModifierMappingSrc":0x700000064,"HIDKeyboardModifierMappingDst":0x700000035}]}'
@danielgospodinow
danielgospodinow / heatersensor.cpp
Last active October 9, 2021 07:38
Heater Sensor
#include <TroykaMQ.h>
#include "RTClib.h"
#include <SPI.h>
#include <SD.h>
#include <LiquidCrystal_PCF8574.h>
#include <Wire.h>
#define MAX_ACCEPTABLE_LPG_VALUE 1000
#define MAX_ACCEPTABLE_METHANE_VALUE 1000
#define MAX_ACCEPTABLE_SMOKE_VALUE 1500
@danielgospodinow
danielgospodinow / zad2.cpp
Created January 1, 2020 21:08
Second task of first exam DSP (81786)
int findLinkedListSize(node<int>* ll) {
int size = 0;
while (ll != NULL) {
++size;
ll = ll->next;
}
return size;
}
@danielgospodinow
danielgospodinow / zad1.cpp
Created January 1, 2020 19:29
First task from the first DSP exam 2019/2020 (81786)
void fillgaps(node<int>* l) {
if(l == nullptr) {
return;
}
node<int>* current = l;
while (current->next != NULL)
{
if (current->data != (current->next->data - 1))
{
@danielgospodinow
danielgospodinow / linkedListGetOperation.hpp
Created September 22, 2019 20:18
Linked List get operation
/**
* Finds and returns an element by its index.
*
* @tparam T type
* @param index index of the required element.
* @return the element required
*/
template<typename T>
T LinkedList<T>::get(const int index) const {
if (index < 0 || index >= _size) {
@danielgospodinow
danielgospodinow / linkedListRemoveAtOperation.hpp
Created September 22, 2019 20:12
Linked List removeAt operation
/**
* Remove an element from a specified index.
*
* @tparam T type
* @param index index of an element
*/
template<typename T>
void LinkedList<T>::removeAt(const int index) {
if (index < 0 || index >= _size) {
// If the index is out of bounds, throw an exception.
@danielgospodinow
danielgospodinow / linkedListRemoveOperation.hpp
Created September 22, 2019 20:11
Linked List remove operation
/**
* Remove all elements from the data structure which match
* the item provided.
*
* @tparam T type
* @param item item to be removed
*/
template<typename T>
void LinkedList<T>::remove(const T &item) {
// Initialize pointers to two consecutive elements