Skip to content

Instantly share code, notes, and snippets.

@vbogretsov
vbogretsov / redis-maxmem
Last active August 9, 2021 13:03
Get maxmemory configured on redis host
redis-cli -p $1 -a $(grep -Po '(?<=^masterauth\s).*' ${2:-/etc/redis.conf} | sed 's/^\"//g' | sed 's/\"$//g') info | grep maxmemory_human
@vbogretsov
vbogretsov / docker.yml
Created December 2, 2020 15:11
LinuxKit docker image for Yandex Cloud
kernel:
image: linuxkit/kernel:5.4.39
cmdline: "console=ttyS0"
init:
- linuxkit/init:a68f9fa0c1d9dbfc9c23663749a0b7ac510cbe1c
- linuxkit/runc:v0.8
- linuxkit/containerd:a4aa19c608556f7d786852557c36136255220c1f
- linuxkit/ca-certificates:v0.8
onboot:
- name: sysctl
@vbogretsov
vbogretsov / sts
Last active November 18, 2019 08:55
Assume AWS role
role=$1
if ! [ $role ]; then
echo "error: [sts] missing required argument ROLE"
exit 1
fi
account_id=$(aws sts get-caller-identity | jq .Account | sed s/\"//g)
if ! [ $account_id ]; then
echo "error: unable to get AWS account ID"
exit 1
@vbogretsov
vbogretsov / mjtest.md
Last active October 16, 2019 15:22
MathJax test
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [ ['$','$'] ], processEscapes: true } });
@vbogretsov
vbogretsov / defaults
Last active June 7, 2025 07:23
OS X disable animations
# opening and closing windows and popovers
defaults write -g NSAutomaticWindowAnimationsEnabled -bool false
# smooth scrolling
defaults write -g NSScrollAnimationEnabled -bool false
# Fonts
# TODO: set 1 for M1
defaults write -g AppleFontSmoothing -int 0
{
"workbench.colorTheme": "Mariana Nord",
"C_Cpp.updateChannel": "Insiders",
"files.exclude": {
"**/.DS_Store": true,
"**/.git": true,
"**/.hg": true,
"**/.svn": true,
"**/*.o": true,
"**/CVS": true,
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
__thread static char* __error = NULL;
#define raize(fmt, ...) \
do { \
size_t errlen = snprintf(NULL, 0, (fmt), ##__VA_ARGS__); \
mkfs.ext4 /dev/nbd1
mount /dev/nbd1 /mnt
curl -sL https://github.com/alpinelinux/apk-tools/releases/download/v2.10.3/apk-tools-2.10.3-armhf-linux.tar.gz -o apk-tools.tar.gz
tar xvzf apk-tools.tar.gz -C .
./apk --arch armhf -X http://dl-cdn.alpinelinux.org/alpine/v3.9/main/ -U --allow-untrusted --root /mnt --initdb add alpine-base curl
cp /etc/resolv.conf /mnt/etc/resolv.conf
mkdir -p /mnt/usr/local/sbin
mkdir -p /mnt/usr/local/bin
mkfs.ext4 /dev/nbd1
mount /dev/nbd1 /mnt
curl -sL https://github.com/alpinelinux/apk-tools/releases/download/v2.10.3/apk-tools-2.10.3-armhf-linux.tar.gz -o apk-tools.tar.gz
tar xvzf apk-tools.tar.gz -C .
./apk --arch armhf -X http://dl-cdn.alpinelinux.org/alpine/v3.9/main/ -U --allow-untrusted --root /mnt --initdb add alpine-base curl
cp /etc/resolv.conf /mnt/etc/resolv.conf
mkdir -p /mnt/usr/local/sbin
mkdir -p /mnt/usr/local/bin
# Define
schemes:
everforest_dark_hard: &everforest_dark_hard
primary:
background: '#2b3339'
foreground: '#d3c6aa'
normal:
black: '#4b565c'
red: '#e67e80'
green: '#a7c080'