Skip to content

Instantly share code, notes, and snippets.

View tholok97's full-sized avatar
🇳🇴

Thomas Løkkeborg tholok97

🇳🇴
View GitHub Profile
@karanlyons
karanlyons / partial_range_update.sql
Last active September 16, 2022 15:11
Postgres: Update only portion of range, preserving other half and bounds.
UPDATE <TABLE> SET
<COLUMN>=<RANGE_TYPE>(
lower(<COLUMN>), -- Swap out for actual value
upper(<COLUMN>), -- Swap out for actual value
concat(
CASE WHEN lower_inc(<COLUMN>) THEN '[' ELSE '(' END,
CASE WHEN upper_inc(<COLUMN>) THEN ']' ELSE ')' END
)
)
WHERE <CONDITION>;
@enzinier
enzinier / install_font_adobe_source_code_pro.sh
Created March 4, 2017 03:38
Install font Adobe Source Code Pro on Ubuntu 16.04 LTS
#!/bin/sh
# Userland mode (~$USER/), (~/).
# ~/.fonts is now deprecated and that
#FONT_HOME=~/.fonts
# ~/.local/share/fonts should be used instead
FONT_HOME=~/.local/share/fonts
echo "installing fonts at $PWD to $FONT_HOME"
mkdir -p "$FONT_HOME/adobe-fonts/source-code-pro"
@peteristhegreat
peteristhegreat / testsuite.cpp
Created August 18, 2017 15:36
QTest QComboBox QListView click on each item in a combobox
// Very helpful link: https://vicrucann.github.io/tutorials/qttest-signals-qtreewidget/
// Select an item in the combobox list
QComboBox * cb = m_widget->findChild<QComboBox*>("testStandComboBox");
QTest::mouseClick(cb, Qt::LeftButton);
QTest::qWait(1000);
QListView * lw = cb->findChild<QListView *>();
if(lw)
{