Skip to content

Instantly share code, notes, and snippets.

View sawaYch's full-sized avatar
🐧
Focusing

Sawa sawaYch

🐧
Focusing
View GitHub Profile
@sawaYch
sawaYch / .travis.yml
Last active May 10, 2023 16:46
Conditional Build in Travis-CI
matrix:
include:
# config for PHP, server side codebase
- language: php
php:
- 7.0
# deploy jobs here
install:
- cd backend_server && composer install
# unit test jobs here
@sawaYch
sawaYch / modern_C++.md
Last active November 4, 2018 15:39
Something you need to care about in modern C++

Vector, Beware of erase()

If you are using this style and when you erase() items in vector, be careful dont perform ++iterator.
Since the pointer to the item that you erase(), it already release, so the pointer target will become unknown,
and causing undefined behaviour if the iteration keep going.
It is possible cause the vector iteration out-of-bound.

template <class T>
void Container<T>::removeValue(T *value, bool deletePointer)
{
	for (iterator i = values.begin(); i != values.end(); ) {
@sawaYch
sawaYch / junit_test.md
Last active November 10, 2018 23:46
Special way to test binding type (JavaFX and Junit)

Special way to test binding type (JavaFX and Junit)

Code of DataModel Class

The class data model is a binding type for javafx bar chart.

public static class DataModel {
    private final SimpleStringProperty title;
    private final SimpleStringProperty price;
    private final SimpleStringProperty url;
    private final SimpleStringProperty postedd;
@sawaYch
sawaYch / IBM_Thinkpad_x60.md
Last active November 19, 2023 10:52
A upgrade log of IBM Thinkpad X60.

IBM Think-Pad X60 Upgrade Log

These day, I tried to upgrade second-hand X60 IBM Think-pad.

It is a really old model (Intel Core 2 Duo ), but still good to use.

It has facing several problems and I am trying to use minimum cost (maybe) to increase the user experience :P

@sawaYch
sawaYch / FIx.md
Created May 20, 2019 12:52
Arch - Plasma Desktop - Second Display Fix

Arch - Plasma Desktop - Second Display Fix

Temp fix on KDE Plasma Desktop for low resolution when external display connected.

➜ ~ xrandr Screen 0: minimum 8 x 8, current 2624 x 900, maximum 32767 x 32767 eDP1 connected primary 1600x900+0+0 (normal left inverted right x axis y axis) 280mm x 160mm 1920x1080 60.04 + 1400x1050 59.98
1600x900 60.00* 1280x1024 60.02

@sawaYch
sawaYch / init.vim
Last active July 4, 2019 16:09
My Neovim config
" Specify a directory for plugins
" - For Neovim: ~/.local/share/nvim/plugged
" - Avoid using standard Vim directory names like 'plugin'
call plug#begin('~/.vim/plugged')
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'scrooloose/nerdtree'
Plug 'jistr/vim-nerdtree-tabs' " enhance nerdtree's tabs
Plug 'ryanoasis/vim-devicons' " add beautiful icons besides files
@sawaYch
sawaYch / code-snippet.js
Created August 15, 2019 18:06
Firebase storage listAll() example.
// Load single image
// replace images/photo6244288433388366130.jpg with your image path
// You can find it on the firebase storage console
var imgRef = firebase.storage().ref().child('images/photo6244288433388366130.jpg');
imgRef.getDownloadURL().then(function(url){
var img = document.getElementById('img1');
img.src = url;
}).catch(function(error) {
@sawaYch
sawaYch / leak.sh
Created October 21, 2019 05:57
NordVPN openvpn private key leak
# _ _
# (c).-.(c)
# / ._. \
# __\( Y )/__
#(_.-/'-'\-._)
# || ||
# _.' `-' '._
#(.-./`-'\.-.)
# `-' `-'
root@vm-fi6:~# lxc-ls
@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 / 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.