Skip to content

Instantly share code, notes, and snippets.

View ObserverHerb's full-sized avatar

Herb ObserverHerb

View GitHub Profile
@ObserverHerb
ObserverHerb / 30_day_03_maximum_subarray.cpp
Last active April 3, 2020 16:16
LeetCode - #53 Maximum Subarray: Failed
#include <vector>
#include <numeric>
class Solution {
public:
int summize(std::vector<int> nums)
{
int result=std::accumulate(nums.begin(),nums.end(),0);
if (nums.size() == 2)
{
@ObserverHerb
ObserverHerb / 30_day_03_maximum_subarray.cpp
Created April 3, 2020 16:17
LeetCode - #53 Maximum Subarray: Passed
#include <vector>
#include <algorithm>
struct SubArray
{
std::vector<int>::iterator low;
std::vector<int>::iterator high;
int sum;
};
@ObserverHerb
ObserverHerb / broadcom-sta-6.30.223.271-r5-linux-5.6.patch
Created April 21, 2020 18:45
Make proprietary Broadcom wireless drivers compile against Linux kernel 5.6 on Gentoo
diff --git a/src/shared/linux_osl.c b/src/shared/linux_osl.c
index 6157d18..8237ec7 100644
--- a/src/shared/linux_osl.c
+++ b/src/shared/linux_osl.c
@@ -942,7 +942,7 @@ osl_getcycles(void)
void *
osl_reg_map(uint32 pa, uint size)
{
- return (ioremap_nocache((unsigned long)pa, (unsigned long)size));
+ return (ioremap((unsigned long)pa, (unsigned long)size));
diff --git a/src/Screen.cpp b/src/Screen.cpp
index bba16a97..1cde7131 100644
--- a/src/Screen.cpp
+++ b/src/Screen.cpp
@@ -461,8 +461,14 @@ void Screen::updateEffectiveRendition()
_effectiveBackground = _currentBackground;
}
- if ((_currentRendition & RE_BOLD) == 0 && (_currentRendition & RE_FAINT) != 0) {
+ if ((_currentRendition & RE_BOLD) != 0) {
@ObserverHerb
ObserverHerb / konsole-21.04.0-selection-color.patch
Created May 4, 2021 10:29
Revert selection color change to Konsole 20.04.0 (ebuild patch)
diff --git a/src/Screen.cpp b/src/Screen.cpp
index 54634d6a..172e4b32 100644
--- a/src/Screen.cpp
+++ b/src/Screen.cpp
@@ -620,7 +620,7 @@ void Screen::copyFromHistory(Character* dest, int startLine, int count) const
if (_selBegin != -1) {
for (int column = 0; column < _columns; column++) {
if (isSelected(column, line)) {
- dest[destLineOffset + column].rendition |= RE_SELECTED;
+ reverseRendition(dest[destLineOffset + column]);
@ObserverHerb
ObserverHerb / AoC_2023_03.py
Created December 3, 2023 23:15
2023 Advent of Code: Day 3
#!/usr/bin/env python3
lines=[]
with open("input.txt",'r') as input:
lines=[line.strip() for line in input.read().strip().split('\n')]
max_lines=len(lines)
max_length=0
ratios: dict[tuple[int,int],list[int]]={} # position of the gear is the key, list of adjacent parts is the value
gear='*'
no_gear=(-1,-1)
@ObserverHerb
ObserverHerb / osk-programmatic.cpp
Created January 4, 2024 07:33
Open On-Screen Keyboard Programmatically in Windows
#include <Windows.h>
int main()
{
INPUT input[3];
input[0].type = INPUT_KEYBOARD;
input[0].ki.wScan = 0;
input[0].ki.time = 0;
input[0].ki.dwExtraInfo = 0;
input[0].ki.wVk = 0x11;
@ObserverHerb
ObserverHerb / populate_tree.cpp
Last active May 27, 2024 18:53
For populating test cases for those LeetCode problems with binary trees
#include <type_traits>
#include <concepts>
#include <vector>
#include <optional>
#include <iostream>
template <typename T>
struct TreeNodeGeneric
{
T val;