Skip to content

Instantly share code, notes, and snippets.

View incidunt's full-sized avatar

incidunt incidunt

View GitHub Profile
@incidunt
incidunt / gist:324537a78fd083af9de4e1493c7e8ee0
Created November 2, 2018 06:46 — forked from rentzsch/gist:1047967
Close a Chrome Tab using AppleScript
tell application "Google Chrome"
set windowList to every tab of every window whose URL starts with "https://mail.google.com"
repeat with tabList in windowList
set tabList to tabList as any
repeat with tabItr in tabList
set tabItr to tabItr as any
delete tabItr
end repeat
end repeat
end tell
@incidunt
incidunt / cctalk.py
Created August 15, 2018 03:11 — forked from leo493852107/cctalk.py
cctalk 根叔
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = "leo"
__time__ = "2018-01-31"
import os
import requests
@incidunt
incidunt / gist:343f87f87bbc34fed2eb2ffc8aebed91
Created June 12, 2018 16:50 — forked from dabrahams/gist:3030332
My new, simpler offlineimap configuration
# -*- mode: conf; -*-
#
# NOTE: Settings generally support python interpolation. This means
# values can contain python format strings which refer to other values
# in the same section, or values in a special DEFAULT section. This
# allows you for example to use common settings for multiple accounts:
#
# [Repository Gmail1]
# trashfolder: %(gmailtrashfolder)s
#
@incidunt
incidunt / auto_switch_kb.py
Created May 17, 2018 08:50 — forked from tiann/auto_switch_kb.py
auto switch keyboard to english in specific applications
#! /usr/bin/env python
# coding: utf-8
'''
auto switch keyboard between different applications
if you want to change the app list, modify the var 'ignore_list'
'''
from AppKit import NSWorkspace, NSWorkspaceDidActivateApplicationNotification, NSWorkspaceApplicationKey
#!/usr/bin/env bash
#
# see: https://gist.github.com/gregorynicholas/2160046ec6946a2ce0fa
# src: https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# updated: 2015-06-06
#
# ask for the administrator password upfront
sudo -v
@incidunt
incidunt / exif_gps.py
Created February 23, 2018 13:45 — forked from snakeye/exif_gps.py
Python: get GPS latitude and longitude coordinates from JPEG EXIF using exifread
import exifread
# based on https://gist.github.com/erans/983821
def _get_if_exist(data, key):
if key in data:
return data[key]
return None
@incidunt
incidunt / tmux-cheatsheet.markdown
Created January 10, 2018 16:48 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@incidunt
incidunt / browser_history.md
Created January 10, 2018 16:37 — forked from dropmeaword/browser_history.md
Playing around with Chrome's history

Browser histories

Unless you are using Safari on OSX, most browsers will have some kind of free plugin that you can use to export the browser's history. So that's probably the easiest way. The harder way, which seems to be what Safari wants is a bit more hacky but it will also work for other browsers. Turns out that most of them, including Safari, have their history saved in some kind of sqlite database file somewhere in your home directory.

The OSX Finder cheats a little bit and doesn't show us all the files that actually exist on our drive. It tries to protect us from ourselves by hiding some system and application-specific files. You can work around this by either using the terminal (my preferred method) or by using the Cmd+Shft+G in Finder.

Finder

Once you locate the file containing the browser's history, copy it to make a backup just in case we screw up.

-------------------------------------------------------------------------------------------
REFERENCES FOR LEARNING & USING APPLESCRIPT Modified: 2016/05/25 15:01
-------------------------------------------------------------------------------------------
NOTES
-------------------------------------------------------------------------------------------
AppleScript is a rather peculiar scripting language to learn.
@incidunt
incidunt / lfs.md
Created March 26, 2016 18:51
lfs note
rpm --import http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

yum install byacc