Skip to content

Instantly share code, notes, and snippets.

View alexander-yakushev's full-sized avatar
🪖
Defending against russian invasion

Oleksandr Yakushev alexander-yakushev

🪖
Defending against russian invasion
View GitHub Profile
@alexander-yakushev
alexander-yakushev / launchbar.lua
Last active April 9, 2020 17:08
Quick launchbar widget for Awesome WM
-- Quick launchbar widget for Awesome WM
-- http://awesome.naquadah.org/wiki/Quick_launch_bar_widget/3.5
-- Put into your awesome/ folder and add the following to rc.lua:
-- local launchbar = require('launchbar')
-- local mylb = launchbar("/path/to/directory/with/shortcuts/")
-- Then add mylb to the wibox.
local layout = require("wibox.layout")
local util = require("awful.util")
local launcher = require("awful.widget.launcher")
@alexander-yakushev
alexander-yakushev / picturesque.lua
Created May 9, 2013 09:44
Automatic wallpaper fetching/changing for Awesome
-- Automatically downloads and sets wallpapers from 4walled.com.
-- Requires asyncshell (https://gist.github.com/alexander-yakushev/1466863)
-- For configuration details see http://awesome.naquadah.org/wiki/Picturesque
-- How to use:
-- local picturesque = require('picturesque')
-- local t = timer { timeout = 3600 }
-- t:connect_signal("timeout", picturesque.change_image)
-- t:start()
local awful = require('awful')
@alexander-yakushev
alexander-yakushev / debugger-wannabe.lisp
Created February 6, 2013 13:22
Debugging functions for SBCL
(declaim (optimize (debug 2)))
;; Part one.
(defun line-number (fname code-loc)
(let* ((all-offsets (sb-di::debug-source-start-positions code-loc))
;; Get last item from the array, I haven't found anything
;; like 'pop' to do it better.
(offset (aref all-offsets (- (length all-offsets) 1))))
(with-open-file (f fname)
@alexander-yakushev
alexander-yakushev / patch.lua
Created June 11, 2012 14:41
Fix move_to_screen in AwesomeWM
function smart_movetoscreen(c, s)
local was_maximized = { h = false, v = false }
if c.maximized_horizontal then
c.maximized_horizontal = false
was_maximized.h = true
end
if c.maximized_vertical then
c.maximized_vertical = false
was_maximized.v = true
end
@alexander-yakushev
alexander-yakushev / clojure-trivial-dialer.clj
Last active October 6, 2015 00:57
A simple demostration of neko.ui toolkit for building Android UI in Clojure
(ns test.leindroid.sample.main
(:use [neko.activity :only [defactivity set-content-view!]]
[neko.threading :only [on-ui]]
[neko.ui :only [make-ui]])
(:import android.widget.EditText
android.net.Uri
android.content.Intent))
(declare ^EditText edit
^android.app.Activity a)
@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 = {}
@alexander-yakushev
alexander-yakushev / tetris.clj
Created September 10, 2011 00:28
Tetris implementation in Clojure
(ns tetris.core
(:import (java.awt Color Dimension BorderLayout)
(javax.swing JPanel JFrame JOptionPane JButton JLabel)
(java.awt.event KeyListener))
(:use clojure.contrib.import-static deflayout.core
clojure.contrib.swing-utils)
(:gen-class))
(import-static java.awt.event.KeyEvent VK_LEFT VK_RIGHT VK_DOWN VK_UP VK_SPACE)