Skip to content

Instantly share code, notes, and snippets.

View daGrevis's full-sized avatar
⌨️
Keyboard operator

Raitis Stengrevics daGrevis

⌨️
Keyboard operator
View GitHub Profile
@daGrevis
daGrevis / init.lua
Created November 27, 2018 15:34
Hammerspoon + AirPods
function airPods(deviceName)
local s = [[
activate application "SystemUIServer"
tell application "System Events"
tell process "SystemUIServer"
set btMenu to (menu bar item 1 of menu bar 1 whose description contains "bluetooth")
tell btMenu
click
]]
..
video-to-gif() {
FPS="${FPS:-10}"
SCALE="${SCALE:-640}"
ffmpeg -i "$@" -vf fps=$FPS,scale=$SCALE:-1:flags=lanczos,palettegen palette.png
ffmpeg -i "$@" -i palette.png -filter_complex "fps=10,scale=640:-1:flags=lanczos[x];[x][1:v]paletteuse" recording.gif
rm palette.png
}
config_path = os.getenv("HOME") .. "/.hammerspoon/"
hs.pathwatcher.new(config_path, function(paths, flagTables)
paths = hs.fnutils.ifilter(paths, function(path)
return not path:ends('.git/index.lock')
end)
if #paths > 0 then
hs.reload()
end
end):start()
local filter = hs.window.filter.new():setDefaultFilter{}
filter:subscribe(hs.window.filter.windowCreated, function(window)
local windowFrame = window:frame()
local screenFrame = window:screen():frame()
windowFrame.x = screenFrame.x
windowFrame.y = screenFrame.y
windowFrame.w = screenFrame.w
windowFrame.h = screenFrame.h
window:setFrame(windowFrame)
end)
let g:ctrlp_map = ''
function! CtrlP()
if (getcwd() == $HOME)
echo "Won't run in ~"
return
endif
if (getcwd() == '/')
echo "Won't run in /"
return
let g:ctrlp_map = ''
function! CtrlP()
if (getcwd() == $HOME)
echo "Won't run in ~"
return
endif
if (getcwd() == '/')
echo "Won't run in /"
return
let g:ctrlp_user_command = {
\ 'types': {
\ 1: ['.git', 'cd %s && git ls-files -oc --exclude-standard'],
\ 2: ['.hg', 'hg --cwd %s locate -I .'],
\ },
\ 'fallback': 'find %s -type f -o -type l'
\ }
hs.window.filter.new():setDefaultFilter{}:subscribe(hs.window.filter.windowCreated, function(window)
local windowFrame = window:frame()
local screenFrame = window:screen():frame()
windowFrame.x = screenFrame.x
windowFrame.y = screenFrame.y
windowFrame.w = screenFrame.w
windowFrame.h = screenFrame.h
window:setFrame(windowFrame)
end)
diff --git a/backend/package.json b/backend/package.json
index 21a1462..166172c 100644
--- a/backend/package.json
+++ b/backend/package.json
@@ -9,6 +9,7 @@
"prettier": "^1.14.3"
},
"dependencies": {
+ "@koa/cors": "^2.2.3",
"bcrypt": "^3.0.0",
! ~ python
Python 2.7.16 (default, Mar 4 2019, 09:01:38)
[GCC 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.11.45.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 'f' in 'foo'
True
>>> keywords = ['foo', 'bar']
>>> text = 'lala foo'
>>> [keyword for keyword in keywords if keyword in text]
['foo']