Skip to content

Instantly share code, notes, and snippets.

@tkdchen
tkdchen / python-linter-configuration-files-matrix.md
Created February 24, 2024 12:52
Python linter configuration files matrix
\ setup.cfg pyproject.toml tox.ini own config file
tox [tox:tox] [tool.tox] [tox] tox.ini
pytest [tool:pytest] [tool.pytest.ini_options] [pytest] pytest.ini
flake8 [flake8] - [flake8] .flake8
mypy [mypy] [tool.mypy] - mypy.ini
black - [tool.black] - .black
type GitClient interface {
GetWebhookByTargetUrl
}
type GitHubClient struct {} // implements interface GitClient
type GitLabClient struct {} // implements interface GitClient
type GitProvder interface {
CreateMergeRequest() error
@tkdchen
tkdchen / install_vb_additions.sh
Last active July 6, 2016 10:21
Install VBoxGuestAdditions in vagrant box
function install_vb_additions
{
local VB_VERSION="$1";
local download_url=http://download.virtualbox.org/virtualbox/${VB_VERSION}/VBoxGuestAdditions_${VB_VERSION}.iso
curl -C - -O $download_url
sudo mkdir /mnt/iso
sudo mount -o loop VBoxGuestAdditions_${VB_VERSION}.iso /mnt/iso
sudo yum install -y kernel-devel-`uname -r` gcc make perl bzip2
pushd /mnt/iso
sudo ./VBoxLinuxAdditions.run
@tkdchen
tkdchen / install_vb_additions.sh
Last active January 11, 2016 02:59
Installl Virtualbox Guest Additions
function install_vb_additions
{
local VB_VERSION="$1";
curl -O http://download.virtualbox.org/virtualbox/${VB_VERSION}/VBoxGuestAdditions_${VB_VERSION}.iso
sudo mkdir /mnt/iso
sudo mount -o loop VBoxGuestAdditions_${VB_VERSION}.iso /mnt/iso
sudo yum install -y kernel-devel-`uname -r` gcc make perl bzip2
cd /mnt/iso
sudo ./VBoxLinuxAdditions.run # Do the task
cd

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@tkdchen
tkdchen / gist:8572180
Created January 23, 2014 03:09
collect static files in SPEC
# Predefinition before doing anything
project_lib=${RPM_BUILD_ROOT}%{python_sitelib}/%{pkg_name}
product_module=${project_lib}/%{pkg_name}/product_settings.py
product_module_bak=${product_module}.bak
static_root=${RPM_BUILD_ROOT}%{_datadir}/%{pkg_name}/static/
# Add all app names whose static files are needed to be collected
# Just enter what you write in settings.py
apps_static_collected_from=""
cp $product_module $product_module_bak
@tkdchen
tkdchen / Adjust screen bightness in LXDE
Last active April 11, 2022 20:43
Add this piece of configuration into ~/.config/openbox/lxde-rc.xml. Then, Fn+Home and Fn+End can increase and decrease screen's brightness individually. After saving, issue command ``$ openbox --reconfigure`` to load new configuration.
<keybind key="XF86MonBrightnessUp">
<action name="Execute">
<command>xbacklight -inc 10%</command>
</action>
</keybind>
<keybind key="XF86MonBrightnessDown">
<action name="Execute">
<command>xbacklight -dec 10%</command>
</action>
</keybind>
@tkdchen
tkdchen / gist:5696319
Created June 3, 2013 05:56
Extract files from RPM package
$ rpm2cpio [filename] | cpio --extract
/*
* As a example here, this function returns the related Model's attribute modelName.
*
* We can access Model's information from constructor attribute.
*/
var getModelName = function(object) {
return object.constructor.modelName
}
@tkdchen
tkdchen / RPM spec template for packaging Python package
Created May 19, 2013 09:32
Make changes according to your requirements. I use $var to indicate what you have to replace with real value. The template follows the RPM package naming convention in Fedora community. That is all Python package's name should have prefix ``python-`` .
%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%global pkg_name $name
Name: python-%{pkg_name}
Version: $version
Release: 1%{?dist}
Summary: $summary
Group: Development/Languages
License: $license