Skip to content

Instantly share code, notes, and snippets.

View nwg-piotr's full-sized avatar
🏠
~/, sweet ~/

Piotr Miller nwg-piotr

🏠
~/, sweet ~/
View GitHub Profile
@nwg-piotr
nwg-piotr / screenshot
Last active May 11, 2023 22:58
Script for taking screenshots on sway and Hyprland
#!/bin/bash
# Original script based on some early version of https://github.com/moverest/sway-interactive-screenshot
# modified for use with key bindings. For now supports sway & Hyprland.
SWAY=$(echo "$SWAYSOCK")
HYPR=$(echo "$HYPRLAND_INSTANCE_SIGNATURE")
if [[ -n "$SWAY" && -n "$HYPR" ]]; then
echo "This script only works on sway or Hyprland, terminating.";
exit 1
$ wcm
II 08-11-20 20:59:09.762 - [subprojects/wf-config/src/file.cpp:445] Reading XML configuration options from directory /opt/wayfire/share/wayfire/metadata
II 08-11-20 20:59:09.762 - [subprojects/wf-config/src/file.cpp:456] Reading XML configuration options from file /opt/wayfire/share/wayfire/metadata/keycolor.xml
II 08-11-20 20:59:09.763 - [subprojects/wf-config/src/file.cpp:456] Reading XML configuration options from file /opt/wayfire/share/wayfire/metadata/simple-tile.xml
II 08-11-20 20:59:09.765 - [subprojects/wf-config/src/file.cpp:456] Reading XML configuration options from file /opt/wayfire/share/wayfire/metadata/grid.xml
II 08-11-20 20:59:09.766 - [subprojects/wf-config/src/file.cpp:456] Reading XML configuration options from file /opt/wayfire/share/wayfire/metadata/scale.xml
II 08-11-20 20:59:09.767 - [subprojects/wf-config/src/file.cpp:456] Reading XML configuration options from file /opt/wayfire/share/wayfire/metadata/idle.xml
II 08-11-20 20:59:09.767 - [subprojects/wf-config/src/file.cpp:456]
Build started at 2020-11-08T20:06:43.595841
Main binary: /usr/bin/python
Build Options: -Dprefix=/opt/wayfire
Python system: Linux
The Meson build system
Version: 0.56.0
Source dir: /home/piotr/Clones/wf-install/wf-shell
Build dir: /home/piotr/Clones/wf-install/wf-shell/build
Build type: native build
Project name: wf-shell
@nwg-piotr
nwg-piotr / main.cpp
Created August 4, 2020 12:46
Pudges exercise in C++
#include <iostream>
#include <string>
int main(int argc, char *argv[]) {
for (int i=1000; i<10000; i++) {
std::string s = std::to_string(i);
int sum = std::stoi(s.substr(0, 2)) + std::stoi(s.substr(2, 2));
if (sum * sum == i) {
std::cout << i << "\n";
}
#!/usr/bin/env python3
for n in range(1000, 10000):
s = str(n)
result = (int(s[:2]) + int(s[2:])) ** 2
if n == result:
print(n)
exit(0) # actually it's unnecessary
@nwg-piotr
nwg-piotr / amdgpu-pro log
Created April 18, 2020 20:11
This is what it looks like with amdgpu-pro.libl installed
[ 3.832] (--) Log file renamed from "/var/log/Xorg.pid-526.log" to "/var/log/Xorg.0.log"
[ 3.833]
X.Org X Server 1.20.8
X Protocol Version 11, Revision 0
[ 3.833] Build Operating System: Linux Arch Linux
[ 3.833] Current Operating System: Linux msi 5.6.4-arch1-1 #1 SMP PREEMPT Mon, 13 Apr 2020 12:21:19 +0000 x86_64
[ 3.833] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-linux root=UUID=b6bdbe39-e79d-4e12-a07b-2b24b1e8d28a rw loglevel=3 quiet
[ 3.833] Build Date: 30 March 2020 05:05:45AM
[ 3.833]
[ 3.833] Current version of pixman: 0.38.4
@nwg-piotr
nwg-piotr / amdgpu-pro log
Created April 18, 2020 20:11
This is what it looks like with amdgpu-pro.libl installed
[ 3.832] (--) Log file renamed from "/var/log/Xorg.pid-526.log" to "/var/log/Xorg.0.log"
[ 3.833]
X.Org X Server 1.20.8
X Protocol Version 11, Revision 0
[ 3.833] Build Operating System: Linux Arch Linux
[ 3.833] Current Operating System: Linux msi 5.6.4-arch1-1 #1 SMP PREEMPT Mon, 13 Apr 2020 12:21:19 +0000 x86_64
[ 3.833] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-linux root=UUID=b6bdbe39-e79d-4e12-a07b-2b24b1e8d28a rw loglevel=3 quiet
[ 3.833] Build Date: 30 March 2020 05:05:45AM
[ 3.833]
[ 3.833] Current version of pixman: 0.38.4
[ 3.608] (--) Log file renamed from "/var/log/Xorg.pid-523.log" to "/var/log/Xorg.0.log"
[ 3.609]
X.Org X Server 1.20.8
X Protocol Version 11, Revision 0
[ 3.609] Build Operating System: Linux Arch Linux
[ 3.609] Current Operating System: Linux msi 5.6.4-arch1-1 #1 SMP PREEMPT Mon, 13 Apr 2020 12:21:19 +0000 x86_64
[ 3.609] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-linux root=UUID=b6bdbe39-e79d-4e12-a07b-2b24b1e8d28a rw loglevel=3 quiet
[ 3.609] Build Date: 30 March 2020 05:05:45AM
[ 3.609]
[ 3.609] Current version of pixman: 0.38.4
[ 3.634] (--) Log file renamed from "/var/log/Xorg.pid-521.log" to "/var/log/Xorg.0.log"
[ 3.635]
X.Org X Server 1.20.8
X Protocol Version 11, Revision 0
[ 3.635] Build Operating System: Linux Arch Linux
[ 3.635] Current Operating System: Linux msi 5.6.4-arch1-1 #1 SMP PREEMPT Mon, 13 Apr 2020 12:21:19 +0000 x86_64
[ 3.635] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-linux root=UUID=b6bdbe39-e79d-4e12-a07b-2b24b1e8d28a rw loglevel=3 quiet
[ 3.635] Build Date: 30 March 2020 05:05:45AM
[ 3.635]
[ 3.635] Current version of pixman: 0.38.4
@nwg-piotr
nwg-piotr / main.py
Last active January 16, 2020 01:21
This snippet uses i3ipc python module to print dimensions of just focused container
#!/usr/bin/env python3
from i3ipc import Connection, Event
i3 = Connection()
def print_dimensions(i3, e):
try:
con = i3.get_tree().find_focused()