Skip to content

Instantly share code, notes, and snippets.

View chew-z's full-sized avatar

Robert J. chew-z

  • Warsaw, Poland
View GitHub Profile
@chew-z
chew-z / Info.plist
Created May 29, 2017 12:51
Launcher for MacVim. Shell script, Applescript and Info.plist - enough to make a full app
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>16E195</string>
<key>CFBundleAllowMixedLocalizations</key>
<true/>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
@chew-z
chew-z / aes.py
Created May 29, 2017 12:42
Do-it-yourself encrypted messaging system
#!/usr/bin/python
# http://depado.markdown blog.com/2015-05-11-aes-cipher-with-python-3-x
import sys
import logging
import argparse
import subprocess
import base64
import hashlib
@chew-z
chew-z / moon.py
Created April 30, 2017 07:57
get todays lunation and moon dates for the year, any year
#!/usr/bin/env python3
'''
Using PyEphem for some scientific fun http://rhodesmill.org/pyephem/
This script shows lunation and moon dates for the year. Maybe more
in a future.
make alias for your shell
alias moon="python3 /path/to/moon.py"
'''
@chew-z
chew-z / oweather.py
Created April 30, 2017 03:44
Yet another weather forecast in your shell
#!/usr/bin/env python3
'''
Yet another weather forecast for your terminal.
usage: python3 oweather.py [-h] [-c CITY] [-w] [-v]
Get weather from OpenWeather.
optional arguments:
-h, --help show this help message and exit
@chew-z
chew-z / fzf-z
Last active February 10, 2021 20:13
fzf-z z on [fzf] steroids
#!/usr/bin/env zsh
# # fzf-z - magic powers of z & fzf combined -
# ALT-Z -> recent folders history and goto
# place in /usr/local/share/zsh/site-functions/
# and add to your .zshrc
# source /usr/local/share/zsh/site-functions/fzf-z
#
# Based on https://github.com/andrewferrier/fzf-z
__fzf-z() {
@chew-z
chew-z / ctrl-p
Last active April 7, 2020 09:52
Ctrl-P fuzzy open/edit files/folders
#!/usr/bin/env zsh
#
# # Ctrl-P - cd to dir or edit file with fzf
# Put in /usr/local/share/zsh/site-functions/
# and add to .zshrc
# source /usr/local/share/zsh/site-functions/ctrl-p
# inspired by
# https://adamheins.com/blog/ctrl-p-in-the-terminal-with-fzf
@chew-z
chew-z / ctrl-vim
Created April 7, 2017 11:07
Ctrl-Vim fuzzy find last edited files
#!/usr/bin/env zsh
#
# Fuzzy find recently edited with [m(vim)|edit|subl] files
# gource in .zshrc and press (Ctrl-V) to call from shell.
# (Enter) opens in vim or (Ctrl-M) in MacVim. Previev (?)
fzf-edit-file-in-vim-or-mvim() {
local out key file helpline
local Vim_binary='/Applications/MacVim.app/Contents/MacOS/Vim'
helpline="<Ctrl-M> opens in MacVim | <?> toggles preview"
@chew-z
chew-z / thesauri.vim
Created April 7, 2017 10:13
Omni completion for thesaurus in VIM
" Moby Project thesaurus integration for vim
" Author: Tom Kurth <tom@losthalo.org>
" Homepage: http://github.com/tomku/thesauri
" License: GPLv2
" Last Modified: Fri, 31 Mar 2017
fun! CompleteThesauri(findstart, base)
if a:findstart
let line = getline('.')
let start = col('.') - 1
@chew-z
chew-z / zeitgeist.pl
Created March 20, 2017 03:39
creates zeitgeist format from words list (for TrackMeNot)
#!/usr/bin/env perl
use strict;
use warnings;
use feature qw(say);
my $outfile = 'zeitgeist.txt';
open(my $fh, '>', $outfile) or die "Cannot create $outfile, $!\n";
@chew-z
chew-z / crx.sh
Created March 3, 2017 08:14
Grab Chrome extension form Web Store
#!/bin/env zsh
mkdir -p chrome-crx
id=$1
downloadUrl="https://clients2.google.com/service/update2/crx?response=redirect&prodversion=56.0&x=id%3D$id%26installsource%3Dondemand%26lang%3Den-US%26uc"
if [ ! -f "chrome-crx/$id.crx" ]; then
curl -Lso "chrome-crx/$id.crx" "$downloadUrl"
fi