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 / 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)
@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 / 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 / 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 / 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 / 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 / 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 / "Stonebreakers" by Ivan Franko
Last active October 5, 2022 04:27
Amateur translation from Ukrainian to English of the poem "Каменярі" ("Kamenyari") written by Іван Франко (Ivan Franko) in 1878.
I had a dream. Like there is ahead
And endless, empty and the wildest plane.
And I stand there, held by iron chain,
Under the tall rock made from finest granite
And next to me are thousands just like me.
The face of everyone is marked by woe and sorrow,
And eyes of everyone contain fervor of love.
And hands of everyone are chained with snakes of iron,
And every shoulder's bent low to the ground,
@alexander-yakushev
alexander-yakushev / minitray.lua
Created December 7, 2013 12:24
Toggable tray for Awesome
-- Toggable tray, for those who don't like to see it all the time.
-- http://awesome.naquadah.org/wiki/Minitray
-- Usage: after requiring a module, bind minitray.toggle() to a key.
local wibox = require("wibox")
-- Module minitray
local minitray = { geometry = {} }
local function show()
@alexander-yakushev
alexander-yakushev / lustrous.lua
Last active May 27, 2024 14:45
Module for calculating sunrise/sunset times for a given location
-- Module for calculating sunrise/sunset times for a given location
-- Based on algorithm by United Stated Naval Observatory, Washington
-- Link: http://williams.best.vwh.net/sunrise_sunset_algorithm.htm
-- @author Alexander Yakushev
-- @license CC0 http://creativecommons.org/about/cc0
-- Module lustrous
local lustrous = {
update_interval = 600
}