Skip to content

Instantly share code, notes, and snippets.

View sawaYch's full-sized avatar
🐧
Focusing

Sawa sawaYch

🐧
Focusing
View GitHub Profile
@sawaYch
sawaYch / component.qml
Created January 10, 2020 15:38
QML svg antialiasing example.
LogoImage {
id: distroLogo
Layout.minimumWidth: (implicitWidth < implicitHeight) ? 100*implicitWidth/implicitHeight : 100
Layout.minimumHeight: (implicitHeight < implicitWidth) ? 100*implicitHeight/implicitWidth : 100
Layout.preferredWidth: (Layout.fillWidth) ? Layout.minimumWidth : height * implicitWidth/implicitHeight
Layout.preferredHeight: (Layout.fillHeight) ? Layout.minimumHeight : width * implicitHeight/implicitWidth
Layout.fillWidth: (implicitWidth < implicitHeight) ? false: true
Layout.fillHeight: !Layout.fillWidth
Layout.alignment: Qt.AlignCenter
@sawaYch
sawaYch / logout-neon
Last active January 10, 2020 15:08
KDE Neon "logout"
#!/bin/bash
# Call qdbus logout ksmserver
qdbus org.kde.ksmserver /KSMServer logout 0 0 0
@sawaYch
sawaYch / kde-plasma-panel_meta-key.md
Created January 8, 2020 22:55
Fix meta key mapping problem to kde plasma default panel.

有咩問題?

你應該知道係KDE Plasma有個比較玄嘅設計:
就係Meta key (Windows Key) 係會被map成組合鍵Alt + F1,
而更加奇怪嘅係,
當你用完Lattle Dock, Set好咗呢一個組合鍵去Trigger Application Launcher,再轉翻用default panel之後;
個組合鍵係會神奇地唔work。

解決方法

改一改呢個file:

@sawaYch
sawaYch / app.cpp
Created January 8, 2020 16:06
qt5 (cpp) : how to center the QApp.
#include "app.h"
#include "ui_app.h"
app::app(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::app)
{
ui->setupUi(this);
connect(this->ui->hashButton, SIGNAL (released()), this, SLOT (handleHashButton()));
this->ui->input->setFocus();
@sawaYch
sawaYch / LUKS-notes.md
Last active August 24, 2023 06:31
Introduction to LUKS.

What is Cryptsetup and LUKS

Cryptsetup is a utility used to conveniently set up disk encryption based
on the DMCrypt kernel module.
These include plain dm-crypt volumes, LUKS volumes, loop-AES
and TrueCrypt (including VeraCrypt extension) formats.
The project also includes a veritysetup utility used to conveniently setup
DMVerity block integrity checking kernel module
and, since version 2.0, integritysetup to setup
DMIntegrity block integrity kernel module.

@sawaYch
sawaYch / SteamPlay.md
Last active December 25, 2019 05:42
Notes about steamplay (Proton)

Now Linux can play windows game through SteamPlay and Proton.
Open steam, in the menu -> settings -> Steam Play -> check the following boxes:

  • 'Enable Steam Play for supported titles'
  • 'Enable Steam Play for all other titles';
    For 'Enable Steam Play for all other titles',
    you can use either Proton 4.11-11 or Steam Linux Runtime (Sometimes Steam Linux Runtime is not working...)

One more thing, make sure to install Vulkan driver (of course you need mesa/ nvidia/ amd GPU drivers before that),
otherwise steam will prompt you your GPU driver is not support directX11.
In Ubuntu, you can install it by:

@sawaYch
sawaYch / demo.py
Created December 24, 2019 07:19
Set up and bug fixed of python3-keyring package.
import keyring
keyring.get_keyring()
keyring.set_password("nordvpn-nm", "username", "Pa$$w0rd")
print(keyring.get_password("nordvpn-nm","username")) # return Pa$$w0rd
@sawaYch
sawaYch / archerc7_openwrt.md
Last active November 9, 2019 08:30
Notes: flashing openwrt to ArcherC7 v2 official firmware

Download

Just download this binary, and rename it to firmware.bin (If the name is too long, it can't upload to the router)
How can I check to official firmware version? -> Go to admin page, you can easily find it.
Download link here: Archer C7 OpenWrt

Installation

For v2.0 official firmware:
We can dirrectly use the official admin page to upload the openwrt firmware (suggest, extremely easy flashing)
Then just wait for a while for the uploading... done.

@sawaYch
sawaYch / convert.sh
Last active December 28, 2019 14:28
Convert *.mp4 to twitter supported video format.
# Thnak you @nik hanselmann
# When you use facebook video downloader like https://www.getfvid.com/,
# You may get a mp4 video that can;t uploaded to twitter (Perhaps codec problems?)
# Or others online converter will give you a video with broken sound channel (audio turns into noises)
# So, what we can do is convert the video source again ot correct format/ codec (libx264).
# You can use the command below:
ffmpeg -i test.mov -vcodec libx264 -vf 'scale=640:trunc(ow/a/2)*2' -acodec aac -vb 1024k -minrate 1024k -maxrate 1024k -bufsize 1024k -ar 44100 -strict experimental -r 30 out.mp4
@sawaYch
sawaYch / leak.sh
Created October 21, 2019 05:57
NordVPN openvpn private key leak
# _ _
# (c).-.(c)
# / ._. \
# __\( Y )/__
#(_.-/'-'\-._)
# || ||
# _.' `-' '._
#(.-./`-'\.-.)
# `-' `-'
root@vm-fi6:~# lxc-ls