Want to create a Gist from your editor, the command line, or the Services menu? Here's how.
#Python 2 | |
python -m SimpleHTTPServer 8080 | |
#Python 3 | |
python3 -m http.server 8113 |
#!/bin/bash | |
LINES=$(tput lines) | |
COLUMNS=$(tput cols) | |
declare -A snowflakes | |
declare -A lastflakes | |
clear |
## Configure eth0 | |
# | |
# vi /etc/sysconfig/network-scripts/ifcfg-eth0 | |
DEVICE="eth0" | |
NM_CONTROLLED="yes" | |
ONBOOT=yes | |
HWADDR=A4:BA:DB:37:F1:04 | |
TYPE=Ethernet | |
BOOTPROTO=static |
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This is an example command for Backtick. A Backtick command consists of some executable JavaScript and a bit of metadata in JSON.
Here are the required steps to create a command:
-
Create a new Gist with a
command.js
andcommand.json
file, or simply fork this one. -
Write your JavaScript in
command.js
. This will be injected into and executed on the page the user is currently on when they run it. -
Add some metadata to the
command.json
file:
- name: The name of the command.
------------------------------------------------------------------------------------------- | |
REFERENCES FOR LEARNING & USING APPLESCRIPT Modified: 2016/05/25 15:01 | |
------------------------------------------------------------------------------------------- | |
NOTES | |
------------------------------------------------------------------------------------------- | |
AppleScript is a rather peculiar scripting language to learn. |
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.
Once you locate the file containing the browser's history, copy it to make a backup just in case we screw up.
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 |