Skip to content

Instantly share code, notes, and snippets.

@dimti
dimti / swap-uid.sh
Last active October 23, 2024 14:03
Swap users uids
SITE_USER=mysiteuser
SITE_GROUP=$(id $SITE_USER | sed -E 's/.+gid=[[:digit:]]+\(([^)]+)\).+/\1/g')
PROJECT_DIR=/var/www/mysiteproject
BUTHEAD_USER=dimti
FROM_UID=1001
TO_UID=1000
INTERMEDIATE_UID=1002
usermod -u $INTERMEDIATE_UID $BUTHEAD_USER && \
groupmod -g $INTERMEDIATE_UID $BUTHEAD_USER && \
@dimti
dimti / yadm.sh
Last active October 23, 2024 10:53
Install or update YADM for root and non-priveleged single user
command -v direnv || curl -sfLo /usr/local/bin/direnv https://github.com/direnv/direnv/releases/download/v2.35.0/direnv.linux-amd64 && chmod a+x /usr/local/bin/direnv
command -v starship || curl -sS https://starship.rs/install.sh | sh -s -- -f > /dev/null
command -v yadm && {
yadm remote set-url origin https://vcs.wpstudio.ru/gitea/dotfiles.git
rm -rf .tmux/plugins/tmux-ip-address
yadm pull && yadm checkout .
} || {
curl -sfLo /usr/local/bin/yadm https://github.com/TheLocehiliosan/yadm/raw/master/yadm && chmod a+x /usr/local/bin/yadm
@dimti
dimti / webopack.config.js
Created February 19, 2021 10:38
webpack config for demonstrate border-width cssnano bug
const webpack = require('webpack');
const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
module.exports = {
entry: './src/index.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js'