Skip to content

Instantly share code, notes, and snippets.

View midenok's full-sized avatar

Aleksey Midenkov midenok

View GitHub Profile
@jmz-b
jmz-b / plasma-restart.service
Created December 12, 2019 14:34
restart KDE Plasma on resume from sleep (helps with nvidia video memory corruption problems)
#~/.config/systemd/user/plasma-restart.service
#systemctl --user enable plasma-restart.service
#systemctl --user start plasma-restart.service
#systemctl --user status plasma-restart.service
#systemctl --user stop plasma-restart.service
#sudo loginctl enable-linger <username>
#systemctl --user daemon-reload
#systemctl --user daemon-reexec
[Unit]
Description=Restart plasmashell after resuming
#!/bin/bash
# Перекодирует рекурсивно в текущем каталоге имена
# файлов и каталогов в транслит.
#
# Источник: http://www.ubuntu.sumy.ua/2011/03/translit.html
shopt -s nullglob
for NAME in * ; do
TRS=`echo $NAME | sed "y/абвгдезийклмнопрстуфхцы/abvgdezijklmnoprstufxcy/"`
TRS=`echo $TRS | sed "y/АБВГДЕЗИЙКЛМНОПРСТУФХЦЫ/ABVGDEZIJKLMNOPRSTUFXCY/"`
@MoOx
MoOx / index.js
Last active February 9, 2024 22:44
Export/import github labels
// go on you labels pages
// eg https://github.com/cssnext/cssnext/labels
// paste this script in your console
// copy the output and now you can import it using https://github.com/popomore/github-labels !
var labels = [];
[].slice.call(document.querySelectorAll(".label-link"))
.forEach(function(element) {
labels.push({
name: element.textContent.trim(),
@emiller
emiller / yoga-auto-rotate
Last active April 22, 2024 15:44
Lenovo Yoga 13 tablet mode / auto rotation script (ubuntu/debian)
#!/bin/bash
#
# yoga-auto-rotate -- ghetto-style tablet mode, with keyboard and all.
#
# Simple little script that will detect an orientation change for a
# Lenovo Yoga 13 (very hackily) and adjust the active display's
# orientation and disable/enable the touchpad as necessary.
#
# The Yoga 13 will emit keycode `e03e` at one second intervals
# when the screen is flipped into tablet mode. Since this keycode
@koblas
koblas / echo.cxx
Created August 15, 2012 22:46
libev c++ echo server
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <stdlib.h>
#include <ev++.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <resolv.h>
#include <errno.h>
#include <list>
@jacobvosmaer
jacobvosmaer / gist:3187346
Created July 27, 2012 10:35
Open all files with git merge conflicts in Vim

Open all files with git merge conflicts in MacVim

git diff --name-only | uniq | xargs mvim

When git encounters a merge conflict, e.g. during a rebase, it drops you back into the shell with a dirty working directory. I like this one-liner for opening all files with a merge conflict in MacVim.

Once you're in Vim, you can then switch between the files with :n and :prev, or another favourite: :w | n (save current file and open the next command line-supplied file).

UPDATE: see below for a version that works with real terminal commands.