Skip to content

Instantly share code, notes, and snippets.

@aajjbb
aajjbb / gist:52ccbfa1e53700944aea
Created January 22, 2015 16:50
this is how to use your mouse/touchpad to control volume in awesome-wm
volumewidget:buttons(awful.util.table.join(
awful.button({ }, 4, function () awful.util.spawn("amixer set Master 2%+") end),
awful.button({ }, 5, function () awful.util.spawn("amixer set Master 2%-") end)
))
"""
aajjbb
python3 script based on ricbit script to dowload all books from computer science section of Springer
It has BeautifulSoup as dependency, easy installed with 'pip install beautifulsoup4'
"""
import re, subprocess, time, sys
-- On rc.lua
function spawn_once(command, class, tag)
-- create move callback
local callback
callback = function(c)
if c.name == class then
awful.client.movetotag(tag, c)
client.disconnect_signal("manage", callback)
end
end
bool searchMatrix(vector<vector<int>>& matrix, int target) {
N = (int) matrix.size();
M = (int) matrix[0].size();
return search(matrix, target, 0, 0, N - 1, M - 1);
}
bool in(int l, int r, int m) {
return m >= l && r >= m;
}
bool searchMatrix(vector<vector<int>>& matrix, int target) {
N = (int) matrix.size();
M = (int) matrix[0].size();
return search(matrix, target, 0, 0, N - 1, M - 1);
}
bool in(int l, int r, int m) {
return m >= l && r >= m;
}
function spawn_once(command, class, tag)
-- create move callback
local callback
callback = function(c)
if c.name == class then
awful.client.movetotag(tag, c)
client.disconnect_signal("manage", callback)
end
end
client.connect_signal("manage", callback)
//Get median of a sequence in O(log(n))
void balance() {
while (abs((int) (minHeap.size() - maxHeap.size())) > 1) {
if (minHeap.size() > maxHeap.size()) {
int tmp = minHeap.top();
minHeap.pop();
maxHeap.push(tmp);
} else {
int tmp = maxHeap.top();
maxHeap.pop();
@aajjbb
aajjbb / Dynamic Median
Created September 6, 2016 03:43
median.cpp
//Get median of a sequence in O(log(n))
void balance() {
while (abs((int) (minHeap.size() - maxHeap.size())) > 1) {
if (minHeap.size() > maxHeap.size()) {
int tmp = minHeap.top();
minHeap.pop();
maxHeap.push(tmp);
} else {
int tmp = maxHeap.top();
maxHeap.pop();
@aajjbb
aajjbb / Dynamic Median.cpp
Created September 6, 2016 03:44
dynamic median
//Get median of a sequence in O(log(n))
void balance() {
while (abs((int) (minHeap.size() - maxHeap.size())) > 1) {
if (minHeap.size() > maxHeap.size()) {
int tmp = minHeap.top();
minHeap.pop();
maxHeap.push(tmp);
} else {
int tmp = maxHeap.top();
maxHeap.pop();
@aajjbb
aajjbb / atom-intern.h
Created September 22, 2016 23:18
atom-intern.h
/* This file is autogenerated by /home/morpho/Devel/awesome-build/awesome/build-utils/atoms-int.sh - do not edit */
xcb_atom_t _NET_SUPPORTED
;
xcb_atom_t _NET_STARTUP_ID
;
xcb_atom_t _NET_CLIENT_LIST
;
xcb_atom_t _NET_CLIENT_LIST_STACKING
;