Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
# coding=utf-8
import json
import ssl
from urllib.request import urlopen
LAT = ""
LONG = ""
ibuys / center_window.applescript
Created November 2, 2016 19:01
Applescript to Center a Window
View center_window.applescript
tell application "Finder"
set screenSize to bounds of window of desktop
set screenWidth to item 3 of screenSize
set screenHeight to item 4 of screenSize
end tell
property WP : 0.1 -- prop of w free screen we want
property HP : 0.02 -- prop of w free screen we want
ibuys /
Created October 22, 2020 21:11 — forked from harishkannarao/


youtube-dl is an opensource command line tool to download video or audio from online video streaming services.

Videos downloaded in mkv or webm extensions can be played by VLC Media player in all major devices and operating systems including iPhone, Android devices.

Tool website:

This gist shows the example commands to use the tool and doesn't support or encourage piracy or violation of copyrights of the online streaming service or the author of the content

Installing youtube-dl:

View gist:12147c7652018c5a9b6977e26ebb072c
" Specify a directory for plugins
" - Avoid using standard Vim directory names like 'plugin'
call plug#begin('~/.vim/plugged')
" You will load your plugin here
" Make sure you use single quotes
" Initialize plugin system
Plug 'tomtom/tcomment_vim'
Plug 'ctrlpvim/ctrlp.vim'
ibuys / gist:0f9820c90ad5d5df7bf6ec4d5f1fe5ce
Created December 20, 2016 23:50 — forked from psilva261/gist:dede25e29198d58c5728
Convert p7b file to pfx file (to use Godaddy SSL/TLS Certificate for Azure Websites)
View gist:0f9820c90ad5d5df7bf6ec4d5f1fe5ce
# Required files:
# .crt and .p7b: provided by Godaddy when exporting
# .key: self-generated file that was needed to create CSR (Certificate signing request)
# Note: this password has nothing to do with the password entered to create the CSR.
# It will be checked once the pfx is uploaded to Azure.
$ openssl pkcs12 -export -in -inkey -certfile -out
Enter Export Password:
Verifying - Enter Export Password:
ibuys /
Created December 12, 2016 16:59 — forked from dkarchmer/
django-boto3-cognito: AWS' Cognito Developer Authenticated Identities Authflow using Django/Python/Boto3 (For building stand-alone clients)
__author__ = 'dkarchmer'
This script emulates a stand-alone Python based client. It relies on Boto3 to access AWS, but
requires your Django server to have an API for your user to access Cognito based credentials
Because of Cognito, the client (this script) will only get temporary AWS credentials associated
to your user and only your user, and based on whatever you configure your AIM Policy to be.
Most Cognito examples demonstrate how to use Cognito for Mobile Apps, so this scripts demonstrate
how to create a stand-alone Python script but operating similarly to these apps.
ibuys / Paste URL From Safari Tab.scpt
Created February 25, 2016 21:50 — forked from gruber/Paste URL From Safari Tab.scpt
Paste URL From Safari Tabs
View Paste URL From Safari Tab.scpt
set _old_delims to AppleScript's text item delimiters
set AppleScript's text item delimiters to {""}
tell application "System Events"
set _current_app to name of the first process whose frontmost is true
end tell
tell application "Safari"
set _urls to {}
repeat with i from 1 to 6 -- how many Safari windows to show URLs from
ibuys / Liberal Regex Pattern for Web URLs
Created February 25, 2016 21:48 — forked from gruber/Liberal Regex Pattern for Web URLs
Liberal, Accurate Regex Pattern for Matching Web URLs
View Liberal Regex Pattern for Web URLs
The regex patterns in this gist are intended only to match web URLs -- http,
https, and naked domains like "". For a pattern that attempts to
match all URLs, regardless of protocol, see:
# Single-line version:
ibuys / inline2ref.rb
Created February 25, 2016 21:48 — forked from gruber/inline2ref.rb
Convert inline Markdown links to references
View inline2ref.rb
#!/usr/bin/env ruby
def e_sh(str)
str.to_s.gsub(/(?=[^a-zA-Z0-9_.\/\-\x7F-\xFF\n])/n, '\\').gsub(/\n/, "'\n'").sub(/^$/, "''")
def find_headers(lines)
in_headers = false
lines.each_with_index {|line, i|
if line =~ /^\S[^\:]+\:( .*?)?$/
ibuys / JavaScript Blacklist
Created February 25, 2016 20:58 — forked from gruber/JavaScript Blacklist
My list of blocked sites for use with Drew Thaler's JavaScript Blacklist extension for Safari (
View JavaScript Blacklist,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,