Skip to content

Instantly share code, notes, and snippets.

View win0err's full-sized avatar
⌨️
Sergei is typing...

Sergei Kolesnikov win0err

⌨️
Sergei is typing...
View GitHub Profile
@win0err
win0err / treemacs-toggle.el
Created August 7, 2023 08:39
Toggle treemacs window
(defun treemacs-toggle ()
"Toggle treemacs exclusively with the current project.
If the treemacs window is visible, hide it; otherwise, create and show it with the current project exclusively."
(interactive)
(if (eq (treemacs-current-visibility) 'visible)
(delete-window (treemacs-get-local-window))
(treemacs-add-and-display-current-project-exclusively)))
(global-set-key (kbd "C-c b") 'treemacs-toggle)
@win0err
win0err / fedora-install-raw-thumbnailer.sh
Created February 19, 2023 22:54
Display .NEF (RAW) thumbnails in Gnome's Nautilus — Fedora
sudo dnf install libopenraw-gnome libopenraw libopenraw-pixbuf-loader raw-thumbnailer
@win0err
win0err / gamecontrollerdb
Last active April 23, 2022 15:03
PS5 Controller Layout for GNOME Games (~/.var/app/org.gnome.Games/config/libmanette/gamecontrollerdb)
030000004c050000e60c000011810000,Sony Interactive Entertainment Wireless Controller,platform:Linux,b:b1,a:b0,x:b3,y:b2,start:b9,guide:b10,back:b8,leftstick:b11,rightstick:b12,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,
import axios from 'axios';
// parameterize :: replace substring in string by template
// parameterize :: Object -> String -> String
// parameterize :: {userId: '123'} -> '/users/:userId/activate' -> '/users/123/activate'
const parameterize = (url, urlParameters) => Object.entries(urlParameters)
.reduce(
(a, [key, value]) => a.replace(`:${key}`, value),
url,
@win0err
win0err / install-apple-emoji.md
Last active March 28, 2024 22:29
💃 Apple Emoji on Linux

Install Apple Color Emoji on Linux

  1. Download font.
mkdir ~/.local/share/fonts/
wget https://github.com/samuelngs/apple-emoji-linux/releases/latest/download/AppleColorEmoji.ttf -O ~/.local/share/fonts/AppleColorEmoji.ttf
# or system-wide to /usr/share/fonts/AppleColorEmoji/, for example
  1. Put Apple Color Emoji on the 1st place in /etc/fonts/conf.d/60-generic.conf:

Keybase proof

I hereby claim:

  • I am win0err on github.
  • I am win0err (https://keybase.io/win0err) on keybase.
  • I have a public key ASBtc0DCpdjb3oFq3rZMjx2i_75fYLN9p3sLte7Q9pslFwo

To claim this, I am signing this object:

@win0err
win0err / 1.sql
Created February 11, 2018 21:13
Продвинутая работа с JSON в MySQL – https://habrahabr.ru/post/348854/
SELECT * FROM `players`;
+----+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------+
| id | player_and_games | names_virtual |
+----+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------+
| 1 | {"id": 1, "name": "Sally", "games_played": {"Puzzler": {"time": 7}, "Battlefield": {"rank": "Sergeant V", "level": 20, "weapon": "sniper rifle"}, "Crazy Tennis": {"won": 4, "lost": 1}}} | Sally |
| 2 | {"id": 2, "name": "Thom", "games_played": {"Puzzler": {"time": 25}, "Battlefiel
import java.awt.Color;
import java.awt.Robot;
import java.awt.AWTException;
import java.awt.MouseInfo;
import java.awt.Point;
public class ColorPicker {
public static void main(String[] args) {
@win0err
win0err / pre-commit
Created September 21, 2017 23:30
A git hook for php-cs-fixer
#!/usr/bin/env php
<?php
exec('git diff --cached --name-only', $stagedFiles);
$fixedFiles = [];
foreach ($stagedFiles as $fileName) {
if (preg_match('/\.php$/', $fileName) && is_file($fileName)) {
exec(sprintf('php-cs-fixer fix %s -q', $fileName), $output, $exitCode);
#!/usr/bin/env sh
extract () {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xvjf $1 ;;
*.tar.gz) tar xvzf $1 ;;
*.tar.xz) tar xvfJ $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar x $1 ;;