Skip to content

Instantly share code, notes, and snippets.

View rayslava's full-sized avatar

rayslava rayslava

View GitHub Profile
@alexander-yakushev
alexander-yakushev / asyncshell.lua
Last active April 28, 2023 13:07
Asyncronous io.popen replacement for Awesome
-- Asynchronous io.popen for Awesome WM.
-- How to use...
-- ...asynchronously:
-- asyncshell.request('wscript -Kiev', function(f) wwidget.text = f:read("*l") end)
-- ...synchronously
-- wwidget.text = asyncshell.demand('wscript -Kiev', 5):read("*l") or "Error"
local awful = require('awful')
asyncshell = {}
@hrldcpr
hrldcpr / tree.md
Last active June 8, 2024 18:11
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

@aras-p
aras-p / preprocessor_fun.h
Last active July 16, 2024 02:50
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active June 16, 2024 13:44
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

@seriyps
seriyps / microlisp.py
Created April 11, 2014 14:00
Lisp subset interpreter
# -*- coding: utf-8 -*-
'''
Created on 2014-04-05
@author: Sergey Prokhorov <me@seriyps.ru>
'''
import re
import operator
import decimal
@jaytaylor
jaytaylor / build.sbt
Created July 31, 2014 20:35
Scala SBT `build.sbt` example of hooking/injecting arbitrary shell commands and using non-native libraries in the build definition via a task run after successful compilation.
organization := "org.foo.bar"
name := "JustAnExample"
version := "1.0"
scalaVersion := "2.10.3"
scalacOptions := Seq("-unchecked", "-deprecation", "-encoding", "utf8")
@Mekk
Mekk / my-window-reuse.el
Last active November 18, 2015 06:26
Emacs snippet to keep single *Man* window (or similar).
;; Based on http://stackoverflow.com/questions/28309340/managing-emacs-man-buffer-location/28311686
(defun enable-window-reuse-for-modes (&rest modes)
"Enables window reuse for given modes - for any of modes specified,
in case there already exist window of given mode, new incarnation will reuse them.
Examples:
(require 'my-window-reuse)
@monkz
monkz / pgp-merge-drv
Created December 16, 2017 22:35 — forked from ewa/pgp-merge-drv
Git merge driver to decrypt (and re-encrypt) files before merging.
#!/bin/bash
# WARNING: This creates and manipulates clear text copies of the
# encrypted files. It tries to clean up afterwards, but lots can go
# wrong. If you are seriously worried about the secrecy of the files,
# don't trust this!
ANCESTOR=$1
MINE=$2
OTHER=$3
@marceloalmeida
marceloalmeida / .gitattributes
Last active July 11, 2024 20:15
How to show diffs for gpg-encrypted files?
*.gpg filter=gpg diff=gpg
*.asc filter=gpg diff=gpg
@AnatomicJC
AnatomicJC / android-backup-apk-and-datas.md
Last active July 18, 2024 22:51
Backup android app, data included, no root needed, with adb

Backup android app, data included, no root needed, with adb

Note: This gist may be outdated, thanks to all contributors in comments.

adb is the Android CLI tool with which you can interact with your android device, from your PC

You must enable developer mode (tap 7 times on the build version in parameters) and install adb on your PC.

Don't hesitate to read comments, there is useful tips, thanks guys for this !