Emacs: improved letter LaTeX snippet.
Luakit: restored and updated Adblock (thus fixing a lot of bugs). Homeinit: added Adblock modules + list automatic update.master
parent
08dc3e6895
commit
02bca376ed
|
@ -1,606 +0,0 @@
|
||||||
------------------------------------------------------------------------
|
|
||||||
-- Simple URI-based content filter --
|
|
||||||
-- (C) 2010 Chris van Dijk (quigybo) <quigybo@hotmail.com> --
|
|
||||||
-- (C) 2010 Mason Larobina (mason-l) <mason.larobina@gmail.com> --
|
|
||||||
-- © 2012 Plaque FCC <Reslayer@ya.ru> --
|
|
||||||
-- © 2010 adblock chromepage from bookmarks.lua by Henning Hasemann & --
|
|
||||||
-- Mason Larobina taken by Plaque FCC. --
|
|
||||||
-- --
|
|
||||||
-- Download an Adblock Plus compatible filter lists to luakit data --
|
|
||||||
-- dir into "/adblock/" directory for multiple lists support or into --
|
|
||||||
-- data dir root to use single file. EasyList is the most popular --
|
|
||||||
-- Adblock Plus filter list: http://easylist.adblockplus.org/ --
|
|
||||||
-- Filterlists need to be updated regularly (~weekly), use cron! --
|
|
||||||
------------------------------------------------------------------------
|
|
||||||
|
|
||||||
local info = info
|
|
||||||
local pairs = pairs
|
|
||||||
local ipairs = ipairs
|
|
||||||
local assert = assert
|
|
||||||
local unpack = unpack
|
|
||||||
local type = type
|
|
||||||
local io = io
|
|
||||||
local os = os
|
|
||||||
local string = string
|
|
||||||
local table = table
|
|
||||||
local tostring = tostring
|
|
||||||
local tonumber = tonumber
|
|
||||||
local webview = webview
|
|
||||||
local lousy = require("lousy")
|
|
||||||
local util = lousy.util
|
|
||||||
local chrome = require("chrome")
|
|
||||||
local capi = { luakit = luakit }
|
|
||||||
local add_binds, add_cmds = add_binds, add_cmds
|
|
||||||
local lfs = require("lfs")
|
|
||||||
local window = window
|
|
||||||
|
|
||||||
module("adblock")
|
|
||||||
|
|
||||||
--- Module global variables
|
|
||||||
local enabled = true
|
|
||||||
-- Adblock Plus compatible filter lists
|
|
||||||
local adblock_dir = capi.luakit.data_dir .. "/adblock/"
|
|
||||||
|
|
||||||
local filterfiles = {}
|
|
||||||
local simple_mode = true
|
|
||||||
local subscriptions_file = adblock_dir .. "/subscriptions"
|
|
||||||
local subscriptions = {}
|
|
||||||
|
|
||||||
|
|
||||||
-- Templates
|
|
||||||
header_template = [==[<div class="header"><h2>AdBlock module: {state}</h2><br>AdBlock is in <b>{mode}</b> mode.{rules}</div><hr>]==]
|
|
||||||
rules_template = [==[ {black} rules blacklisting, {white} rules whitelisting.]==]
|
|
||||||
block_template = [==[<div class="tag"><h1>{opt}</h1><ul>{links}</ul></div>]==]
|
|
||||||
list_template_enabled = [==[<li>{title}: <i>(b{black}/w{white}), </i> <a href="{uri}">{name}</a> <span class="id">{id}</span></li>]==]
|
|
||||||
list_template_disabled = [==[<li>{title}: <a href="{uri}">{name}</a> <span class="id">{id}</span></li>]==]
|
|
||||||
|
|
||||||
html_template = [==[
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>{title}</title>
|
|
||||||
<style type="text/css">
|
|
||||||
{style}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
{header}
|
|
||||||
{opts}
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
]==]
|
|
||||||
|
|
||||||
-- Template subs
|
|
||||||
html_page_title = "AdBlock filters"
|
|
||||||
|
|
||||||
html_style = [===[
|
|
||||||
body {
|
|
||||||
font-family: monospace;
|
|
||||||
margin: 25px;
|
|
||||||
line-height: 1.5em;
|
|
||||||
font-size: 12pt;
|
|
||||||
}
|
|
||||||
div.tag {
|
|
||||||
width: 100%;
|
|
||||||
padding: 0px;
|
|
||||||
margin: 0 0 25px 0;
|
|
||||||
clear: both;
|
|
||||||
}
|
|
||||||
span.id {
|
|
||||||
font-size: small;
|
|
||||||
color: #333333;
|
|
||||||
float: right;
|
|
||||||
}
|
|
||||||
.tag ul {
|
|
||||||
padding: 0;
|
|
||||||
margin: 0;
|
|
||||||
list-style-type: none;
|
|
||||||
}
|
|
||||||
.tag h1 {
|
|
||||||
font-size: 12pt;
|
|
||||||
font-weight: bold;
|
|
||||||
font-style: normal;
|
|
||||||
font-variant: small-caps;
|
|
||||||
padding: 0 0 5px 0;
|
|
||||||
margin: 0;
|
|
||||||
color: #CC3333;
|
|
||||||
border-bottom: 1px solid #aaa;
|
|
||||||
}
|
|
||||||
.tag a:link {
|
|
||||||
color: #0077bb;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
.tag a:hover {
|
|
||||||
color: #0077bb;
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
]===]
|
|
||||||
|
|
||||||
|
|
||||||
-- String patterns to filter URI's with
|
|
||||||
local rules = {}
|
|
||||||
|
|
||||||
-- Functions to filter URI's by
|
|
||||||
-- Return true or false to allow or block respectively, nil to continue matching
|
|
||||||
local filterfuncs = {}
|
|
||||||
|
|
||||||
-- Enable or disable filtering
|
|
||||||
enable = function ()
|
|
||||||
enabled = true
|
|
||||||
refresh_views()
|
|
||||||
end
|
|
||||||
disable = function ()
|
|
||||||
enabled = false
|
|
||||||
refresh_views()
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Report AdBlock state: «Enabled» or «Disabled»
|
|
||||||
state = function()
|
|
||||||
if enabled then
|
|
||||||
return "Enabled"
|
|
||||||
else
|
|
||||||
return "Disabled"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
mode = function()
|
|
||||||
if simple_mode then
|
|
||||||
return "simple"
|
|
||||||
else
|
|
||||||
return "normal"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Detect files to read rules from
|
|
||||||
function detect_files()
|
|
||||||
local curdir = lfs.currentdir()
|
|
||||||
-- Try to find subscriptions directory:
|
|
||||||
if not lfs.chdir(adblock_dir) then
|
|
||||||
lfs.mkdir(adblock_dir)
|
|
||||||
else
|
|
||||||
simple_mode = false
|
|
||||||
-- Look for filters lists:
|
|
||||||
lfs.chdir(curdir)
|
|
||||||
for filename in lfs.dir(adblock_dir) do
|
|
||||||
if string.find(filename, ".txt$") then
|
|
||||||
info("adblock: Found adblock list: " .. filename)
|
|
||||||
table.insert(filterfiles, filename)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if table.maxn(filterfiles) < 1 then
|
|
||||||
simple_mode = true
|
|
||||||
filterfiles = { "/easylist.txt" }
|
|
||||||
end
|
|
||||||
|
|
||||||
if not simple_mode then
|
|
||||||
info( "adblock: Found " .. table.maxn(filterfiles) .. " rules lists.\n" )
|
|
||||||
end
|
|
||||||
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Convert Adblock Plus filter description to lua string pattern
|
|
||||||
-- See http://adblockplus.org/en/filters for more information
|
|
||||||
abp_to_pattern = function (s)
|
|
||||||
-- Strip filter options
|
|
||||||
local opts
|
|
||||||
local pos = string.find(s, "%$")
|
|
||||||
if pos then
|
|
||||||
s, opts = string.sub(s, 0, pos-1), string.sub(s, pos+1)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Protect magic characters (^$()%.[]*+-?) not used by ABP (^$()[]*)
|
|
||||||
s = string.gsub(s, "([%%%.%+%-%?])", "%%%1")
|
|
||||||
|
|
||||||
-- Wildcards are globbing
|
|
||||||
s = string.gsub(s, "%*", "%.%*")
|
|
||||||
|
|
||||||
-- Caret is separator (anything but a letter, a digit, or one of the following:Â - . %)
|
|
||||||
s = string.gsub(s, "%^", "[^%%w%%-%%.%%%%]")
|
|
||||||
|
|
||||||
-- Double pipe is domain anchor (beginning only)
|
|
||||||
-- Unfortunately "||example.com" will also match "wexample.com" (lua doesn't do grouping)
|
|
||||||
s = string.gsub(s, "^||", "^https?://w?w?w?%%d?%.?")
|
|
||||||
|
|
||||||
-- Pipe is anchor
|
|
||||||
s = string.gsub(s, "^|", "%^")
|
|
||||||
s = string.gsub(s, "|$", "%$")
|
|
||||||
|
|
||||||
-- Convert to lowercase ($match-case option is not honoured)
|
|
||||||
s = string.lower(s)
|
|
||||||
|
|
||||||
|
|
||||||
return s
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Parses an Adblock Plus compatible filter list
|
|
||||||
parse_abpfilterlist = function (filename)
|
|
||||||
if os.exists(filename) then
|
|
||||||
info("adblock: loading filterlist %s", filename)
|
|
||||||
else
|
|
||||||
info("adblock: error loading filter list (%s: No such file or directory)", filename)
|
|
||||||
end
|
|
||||||
local pat
|
|
||||||
local white, black = {}, {}
|
|
||||||
for line in io.lines(filename) do
|
|
||||||
-- Ignore comments, header and blank lines
|
|
||||||
if line:match("^[![]") or line:match("^$") then
|
|
||||||
-- dammitwhydoesntluahaveacontinuestatement
|
|
||||||
|
|
||||||
-- Ignore element hiding
|
|
||||||
elseif line:match("#") then
|
|
||||||
|
|
||||||
-- Check for exceptions (whitelist)
|
|
||||||
elseif line:match("^@@") then
|
|
||||||
pat = abp_to_pattern(string.sub(line, 3))
|
|
||||||
if pat and pat ~= "^http://" then
|
|
||||||
table.insert(white, pat)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Add everything else to blacklist
|
|
||||||
else
|
|
||||||
pat = abp_to_pattern(line)
|
|
||||||
if pat and pat ~= "^http:" and pat ~= ".*" then
|
|
||||||
table.insert(black, pat)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return white, black
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Refresh open filters views (if any)
|
|
||||||
function refresh_views()
|
|
||||||
for _, w in pairs(window.bywidget) do
|
|
||||||
for _, v in ipairs(w.tabs.children) do
|
|
||||||
if string.match(v.uri, "^luakit://adblock/?") then
|
|
||||||
v:reload()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Load filter list files
|
|
||||||
load = function (reload, single_list)
|
|
||||||
if reload then subscriptions, filterfiles = {}, {} end
|
|
||||||
detect_files()
|
|
||||||
if not simple_mode and not single_list then
|
|
||||||
read_subscriptions()
|
|
||||||
local files_list = {}
|
|
||||||
for _, filename in ipairs(filterfiles) do
|
|
||||||
local list = subscriptions[filename]
|
|
||||||
if list and util.table.hasitem(list.opts, "Enabled") then
|
|
||||||
table.insert(files_list, filename)
|
|
||||||
else
|
|
||||||
add_list("", filename, "Disabled", true, false)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
filterfiles = files_list
|
|
||||||
-- Yes we may have changed subscriptions and even fixed something with them.
|
|
||||||
write_subscriptions()
|
|
||||||
end
|
|
||||||
|
|
||||||
-- [re-]loading:
|
|
||||||
if reload then rules = {} end
|
|
||||||
local filters_dir = adblock_dir
|
|
||||||
if simple_mode then
|
|
||||||
filters_dir = capi.luakit.data_dir
|
|
||||||
end
|
|
||||||
local filterfiles_loading = {}
|
|
||||||
if single_list and not reload then
|
|
||||||
filterfiles_loading = { single_list }
|
|
||||||
else
|
|
||||||
filterfiles_loading = filterfiles
|
|
||||||
end
|
|
||||||
for _, filename in ipairs(filterfiles_loading) do
|
|
||||||
local white, black = parse_abpfilterlist(filters_dir .. filename)
|
|
||||||
local list = {}
|
|
||||||
if not simple_mode then
|
|
||||||
list = subscriptions[filename]
|
|
||||||
else
|
|
||||||
local list_found = rules[filename]
|
|
||||||
if list_found then
|
|
||||||
list = list_found
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if not util.table.hasitem(rules, list) then
|
|
||||||
rules[filename] = list
|
|
||||||
end
|
|
||||||
list.title, list.white, list.black = filename, table.maxn(white) or 0, table.maxn(black) or 0
|
|
||||||
list.whitelist, list.blacklist = white or {}, black or {}
|
|
||||||
end
|
|
||||||
|
|
||||||
refresh_views()
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Tests URI against user-defined filter functions, then whitelist, then blacklist
|
|
||||||
match = function (uri, signame)
|
|
||||||
-- Matching is not case sensitive
|
|
||||||
uri = string.lower(uri)
|
|
||||||
signame = signame or ""
|
|
||||||
|
|
||||||
-- Test uri against filterfuncs
|
|
||||||
for _, func in ipairs(filterfuncs) do
|
|
||||||
local ret = func(uri)
|
|
||||||
if ret ~= nil then
|
|
||||||
info("adblock: filter function %s returned %s to uri %s", tostring(func), tostring(ret), uri)
|
|
||||||
return ret
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Test against each list's whitelist rules first
|
|
||||||
for _, list in pairs(rules) do
|
|
||||||
-- Check for a match to whitelist
|
|
||||||
for _, pattern in ipairs(list.whitelist or {}) do
|
|
||||||
if string.match(uri, pattern) then
|
|
||||||
info("adblock: allowing %q as pattern %q matched to uri %s", signame, pattern, uri)
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Test against each list's blacklist rules
|
|
||||||
for _, list in pairs(rules) do
|
|
||||||
-- Check for a match to blacklist
|
|
||||||
for _, pattern in ipairs(list.blacklist or {}) do
|
|
||||||
if string.match(uri, pattern) then
|
|
||||||
info("adblock: blocking %q as pattern %q matched to uri %s", signame, pattern, uri)
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Direct requests to match function
|
|
||||||
filter = function (v, uri, signame)
|
|
||||||
if enabled then return match(uri, signame or "") end
|
|
||||||
end
|
|
||||||
|
|
||||||
function table.itemid(t, item)
|
|
||||||
local pos = 0
|
|
||||||
for id, v in pairs(t) do
|
|
||||||
pos = pos + 1
|
|
||||||
if v == item then
|
|
||||||
return pos
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Connect signals to all webview widgets on creation
|
|
||||||
webview.init_funcs.adblock_signals = function (view, w)
|
|
||||||
view:add_signal("navigation-request", function (v, uri) return filter(v, uri, "navigation-request") end)
|
|
||||||
view:add_signal("resource-request-starting", function (v, uri) return filter(v, uri, "resource-request-starting") end)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Remove options and add new ones to list
|
|
||||||
-- @param list_index Index of the list to modify
|
|
||||||
-- @param opt_ex Options to exclude
|
|
||||||
-- @param opt_inc Options to include
|
|
||||||
function list_opts_modify(list_index, opt_ex, opt_inc)
|
|
||||||
assert( simple_mode == false, "adblock list management: not supported in simple mode" )
|
|
||||||
assert(type(list_index) == "number", "list options modify: invalid list index")
|
|
||||||
assert(list_index > 0, "list options modify: index has to be > 0")
|
|
||||||
if not opt_ex then opt_ex = {} end
|
|
||||||
if not opt_inc then opt_inc = {} end
|
|
||||||
|
|
||||||
if type(opt_ex) == "string" then opt_ex = util.string.split(opt_ex) end
|
|
||||||
if type(opt_inc) == "string" then opt_inc = util.string.split(opt_inc) end
|
|
||||||
|
|
||||||
local list = util.table.values(subscriptions)[list_index]
|
|
||||||
local opts = opt_inc
|
|
||||||
for _, opt in ipairs(list.opts) do
|
|
||||||
if not util.table.hasitem(opt_ex, opt) then
|
|
||||||
table.insert(opts, opt)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Manage list's rules
|
|
||||||
local listIDfound = table.itemid(rules, list)
|
|
||||||
if util.table.hasitem(opt_inc, "Enabled") then
|
|
||||||
if not listIDfound then
|
|
||||||
load(false, list.title)
|
|
||||||
end
|
|
||||||
elseif util.table.hasitem(opt_inc, "Disabled") then
|
|
||||||
rules[list.title] = nil
|
|
||||||
end
|
|
||||||
|
|
||||||
list.opts = opts
|
|
||||||
write_subscriptions()
|
|
||||||
refresh_views()
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Add a list to the in-memory lists table
|
|
||||||
function add_list(uri, title, opts, replace, save_lists)
|
|
||||||
assert( (title ~= nil) and (title ~= ""), "adblock list add: no title given")
|
|
||||||
if not opts then opts = {} end
|
|
||||||
|
|
||||||
-- Create tags table from string
|
|
||||||
if type(opts) == "string" then opts = util.string.split(opts) end
|
|
||||||
if table.maxn(opts) == 0 then table.insert(opts, "Disabled") end
|
|
||||||
if not replace and ( subscriptions[title] or subscriptions[uri] ) then
|
|
||||||
local list = subscriptions[title] or subscriptions[uri]
|
|
||||||
-- Merge tags
|
|
||||||
for _, opts in ipairs(opts) do
|
|
||||||
if not util.table.hasitem(list, opts) then table.insert(list, opts) end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
-- Insert new adblock list
|
|
||||||
local list = { uri = uri, title = title, opts = opts }
|
|
||||||
if not (uri == "" or uri == nil) then
|
|
||||||
subscriptions[uri] = list
|
|
||||||
end
|
|
||||||
if not (title == "" or title == nil) then
|
|
||||||
subscriptions[title] = list
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Save by default
|
|
||||||
if save_lists ~= false then write_subscriptions() end
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Save the in-memory subscriptions to flatfile.
|
|
||||||
-- @param file The destination file or the default location if nil.
|
|
||||||
function write_subscriptions(file)
|
|
||||||
if not file then file = subscriptions_file end
|
|
||||||
|
|
||||||
local lines = {}
|
|
||||||
local added = {}
|
|
||||||
for _, list in pairs(subscriptions) do
|
|
||||||
if not util.table.hasitem(added, list) then
|
|
||||||
local subs = { uri = list.uri, title = list.title, opts = table.concat(list.opts or {}, " "), }
|
|
||||||
local line = string.gsub("{title}\t{uri}\t{opts}", "{(%w+)}", subs)
|
|
||||||
table.insert(added, list)
|
|
||||||
table.insert(lines, line)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Write table to disk
|
|
||||||
local fh = io.open(file, "w")
|
|
||||||
fh:write(table.concat(lines, "\n"))
|
|
||||||
io.close(fh)
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Load subscriptions from a flatfile to memory.
|
|
||||||
-- @param file The subscriptions file or the default subscriptions location if nil.
|
|
||||||
-- @param clear_first Should the subscriptions in memory be dumped before loading.
|
|
||||||
function read_subscriptions(file, clear_first)
|
|
||||||
if clear_first then clear() end
|
|
||||||
|
|
||||||
-- Find a subscriptions file
|
|
||||||
if not file then file = subscriptions_file end
|
|
||||||
if not os.exists(file) then return end
|
|
||||||
|
|
||||||
-- Read lines into subscriptions data table
|
|
||||||
for line in io.lines(file or subscriptions_file) do
|
|
||||||
local title, uri, opts = unpack(util.string.split(line, "\t"))
|
|
||||||
if title ~= "" then add_list(uri, title, opts, false, false) end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Shows the chrome page in the given view.
|
|
||||||
chrome.add("adblock/", function (view, uri)
|
|
||||||
-- Get a list of all the unique tags in all the lists and build a
|
|
||||||
-- relation between a given tag and a list of subscriptions with that tag.
|
|
||||||
local opts = {}
|
|
||||||
local id = 0
|
|
||||||
for _, list in pairs(subscriptions) do
|
|
||||||
id = id + 1
|
|
||||||
list['id'] = id
|
|
||||||
for _, opt in ipairs(list.opts) do
|
|
||||||
if not opts[opt] then opts[opt] = {} end
|
|
||||||
opts[opt][list.title] = list
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- For each opt build a block
|
|
||||||
local lines = {}
|
|
||||||
for _, opt in ipairs(util.table.keys(opts)) do
|
|
||||||
local links = {}
|
|
||||||
for _, title in ipairs(util.table.keys(opts[opt])) do
|
|
||||||
local list = opts[opt][title]
|
|
||||||
local link_subs = {
|
|
||||||
uri = list.uri,
|
|
||||||
id = list.id,
|
|
||||||
name = util.escape(list.uri),
|
|
||||||
title = list.title,
|
|
||||||
white = list.white,
|
|
||||||
black = list.black,
|
|
||||||
}
|
|
||||||
local list_template = list_template_disabled
|
|
||||||
-- Show rules count only when enabled this list and have read its rules
|
|
||||||
if util.table.hasitem(list.opts, "Enabled") and list.white and list.black then
|
|
||||||
-- For totals count items only once (protection from multi-tagging by several opts confusion)
|
|
||||||
list_template = list_template_enabled
|
|
||||||
end
|
|
||||||
local link = string.gsub(list_template, "{(%w+)}", link_subs)
|
|
||||||
table.insert(links, link)
|
|
||||||
end
|
|
||||||
|
|
||||||
local block_subs = {
|
|
||||||
opt = opt,
|
|
||||||
links = table.concat(links, "\n")
|
|
||||||
}
|
|
||||||
local block = string.gsub(block_template, "{(%w+)}", block_subs)
|
|
||||||
table.insert(lines, block)
|
|
||||||
end
|
|
||||||
|
|
||||||
local rulescount = { black = 0, white = 0 }
|
|
||||||
for _, list in pairs(rules) do
|
|
||||||
if list.black and list.white then
|
|
||||||
rulescount.black, rulescount.white = rulescount.black + list.black, rulescount.white + list.white
|
|
||||||
end
|
|
||||||
end
|
|
||||||
-- Display rules count only if have them been count
|
|
||||||
local html_rules = ""
|
|
||||||
if rulescount.black + rulescount.white > 0 then
|
|
||||||
html_rules = string.gsub(rules_template, "{(%w+)}", rulescount)
|
|
||||||
end
|
|
||||||
-- Fill the header
|
|
||||||
local header_subs = {
|
|
||||||
state = state(),
|
|
||||||
mode = mode(),
|
|
||||||
rules = html_rules,
|
|
||||||
}
|
|
||||||
local html_page_header = string.gsub(header_template, "{(%w+)}", header_subs)
|
|
||||||
|
|
||||||
local html_subs = {
|
|
||||||
opts = table.concat(lines, "\n\n"),
|
|
||||||
title = html_page_title,
|
|
||||||
header = html_page_header,
|
|
||||||
style = html_style,
|
|
||||||
}
|
|
||||||
|
|
||||||
local html = string.gsub(html_template, "{(%w+)}", html_subs)
|
|
||||||
view:load_string(html, tostring(uri))
|
|
||||||
end)
|
|
||||||
|
|
||||||
-- URI of the chrome page
|
|
||||||
chrome_page = "luakit://adblock/"
|
|
||||||
|
|
||||||
-- Add normal binds.
|
|
||||||
local key, buf = lousy.bind.key, lousy.bind.buf
|
|
||||||
add_binds("normal", {
|
|
||||||
buf("^ga$", function (w)
|
|
||||||
w:navigate(chrome_page)
|
|
||||||
end),
|
|
||||||
|
|
||||||
buf("^gA$", function (w, b, m)
|
|
||||||
for i=1, m.count do
|
|
||||||
w:new_tab(chrome_page)
|
|
||||||
end
|
|
||||||
end, {count=1}),
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
-- Add commands.
|
|
||||||
local cmd = lousy.bind.cmd
|
|
||||||
add_cmds({
|
|
||||||
cmd({"adblock-reload", "abr"}, function (w)
|
|
||||||
info("adblock: Reloading filters.")
|
|
||||||
load(true)
|
|
||||||
info("adblock: Reloading filters complete.")
|
|
||||||
end),
|
|
||||||
|
|
||||||
cmd("adblock", function (w)
|
|
||||||
w:navigate("luakit://adblock/")
|
|
||||||
end),
|
|
||||||
|
|
||||||
cmd({"adblock-list-enable", "able"}, function (w, a)
|
|
||||||
list_opts_modify(tonumber(a), "Disabled", "Enabled")
|
|
||||||
end),
|
|
||||||
|
|
||||||
cmd({"adblock-list-disable", "abld"}, function (w, a)
|
|
||||||
list_opts_modify(tonumber(a), "Enabled", "Disabled")
|
|
||||||
end),
|
|
||||||
cmd({"adblock-enable", "abe"}, function (w)
|
|
||||||
enable()
|
|
||||||
end),
|
|
||||||
|
|
||||||
cmd({"adblock-disable", "abd"}, function (w)
|
|
||||||
disable()
|
|
||||||
end),
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Initialise module
|
|
||||||
load()
|
|
|
@ -213,6 +213,7 @@ webview.init_funcs.window_decision = function (view, w)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Adblock
|
-- Adblock
|
||||||
-- require("adblock")
|
require("adblock")
|
||||||
|
require("adblock_chrome")
|
||||||
|
|
||||||
-- vim: et:sw=4:ts=8:sts=4:tw=80
|
-- vim: et:sw=4:ts=8:sts=4:tw=80
|
||||||
|
|
|
@ -1,25 +1,25 @@
|
||||||
# -*- mode: snippet -*-
|
# -*- mode: snippet -*-
|
||||||
# contributor : Xavier Danaux <xdanaux@gmail.com>
|
# contributor : Xavier Danaux <xdanaux@gmail.com>
|
||||||
# contributor : Pierre Neidhardt <ambrevar at gmail dot com> 2012-04-27
|
# contributor : Pierre Neidhardt <ambrevar at gmail dot com> 2012-09-10
|
||||||
# key: letter
|
# key: letter
|
||||||
# group: skeleton
|
# group: skeleton
|
||||||
# name: \documentclass{article} % Letter style
|
# name: Modern Letter class
|
||||||
# --
|
# --
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
\documentclass[12pt]{article}
|
\documentclass[12pt]{article}
|
||||||
\usepackage[utf8]{inputenc}
|
\usepackage[utf8]{inputenc}
|
||||||
\usepackage[T1]{fontenc}
|
\usepackage{marvosym}
|
||||||
|
\usepackage{eurosym}
|
||||||
|
\DeclareUnicodeCharacter{20AC}{\euro{}}
|
||||||
|
% \usepackage[T1]{fontenc}
|
||||||
% \usepackage{lmodern}
|
% \usepackage{lmodern}
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
%%==============================================================================
|
%%==============================================================================
|
||||||
%% Localization
|
%% Localization
|
||||||
%%==============================================================================
|
%%==============================================================================
|
||||||
|
%% Supported locales: en, fr.
|
||||||
%% Each language has 2 entries.
|
\def\locale{en}
|
||||||
%% The one with an argument activates the text, the other one disables it.
|
|
||||||
% \renewcommand{\locale}{en}
|
|
||||||
\def\locale{${1:en}}
|
|
||||||
|
|
||||||
%%==============================================================================
|
%%==============================================================================
|
||||||
%% Personal Information
|
%% Personal Information
|
||||||
|
@ -27,20 +27,20 @@
|
||||||
|
|
||||||
\def\firstname{Pierre}
|
\def\firstname{Pierre}
|
||||||
\def\familyname{Neidhardt}
|
\def\familyname{Neidhardt}
|
||||||
\def\street{77 rue Bellecombe}
|
\def\street{}
|
||||||
\def\postcode{69006}
|
\def\postcode{}
|
||||||
\def\city{Lyon}
|
\def\city{}
|
||||||
\def\country{France}
|
\def\country{}
|
||||||
\def\phone{\en{(+33) }09 52 92 86 07}
|
\def\mobile{\en{(+00) }00 00 00}
|
||||||
\def\mobile{\en{(+33) }07 61 08 55 94}
|
\def\phone{\en{(+00) }00 00 00}
|
||||||
\def\mail{ambrevar at gmail dot com}
|
\def\mail{}
|
||||||
\def\institute{INSA Lyon}
|
% \def\institute{} %% Not used.
|
||||||
|
|
||||||
%%==============================================================================
|
%%==============================================================================
|
||||||
%% Recipient Information
|
%% Recipient Information
|
||||||
%%==============================================================================
|
%%==============================================================================
|
||||||
|
|
||||||
%% Recipient gender
|
%% Recipient gender. Can be male, female, org.
|
||||||
\def\gender{${2:male}}
|
\def\gender{${2:male}}
|
||||||
|
|
||||||
%% Recipient
|
%% Recipient
|
||||||
|
@ -51,72 +51,79 @@
|
||||||
\def\recipientcity{${7:City}}
|
\def\recipientcity{${7:City}}
|
||||||
\def\recipientpostcode{${8:Postcode}}
|
\def\recipientpostcode{${8:Postcode}}
|
||||||
|
|
||||||
|
%%==============================================================================
|
||||||
|
%% Subject
|
||||||
|
%%==============================================================================
|
||||||
|
|
||||||
|
\def\subject{${9:Subject}}
|
||||||
|
|
||||||
%%==============================================================================
|
%%==============================================================================
|
||||||
%% PDF Metadata
|
%% PDF Metadata
|
||||||
%%==============================================================================
|
%%==============================================================================
|
||||||
|
|
||||||
\def\FileAuthor{\firstname{} \familyname}
|
\def\FileAuthor{\firstname{} \familyname}
|
||||||
\def\FileTitle{\firstname{} \familyname{}'s cover letter}
|
\def\FileTitle{Letter}
|
||||||
\def\FileSubject{Cover letter}
|
\def\FileSubject{\subject{}}
|
||||||
\def\FileKeyWords{\firstname{} \familyname, Cover letter}
|
% \def\FileKeyWords{\firstname{} \familyname, letter}
|
||||||
|
|
||||||
|
|
||||||
%%==============================================================================
|
|
||||||
%% Aliases
|
|
||||||
%%==============================================================================
|
|
||||||
|
|
||||||
\let\latextemp\LaTeX
|
|
||||||
\renewcommand{\LaTeX}{{\rm \latextemp}}
|
|
||||||
|
|
||||||
|
|
||||||
%%==============================================================================
|
%%==============================================================================
|
||||||
%% General options
|
%% General options
|
||||||
%%==============================================================================
|
%%==============================================================================
|
||||||
|
|
||||||
\usepackage{lmodern}
|
|
||||||
\usepackage{eukdate}
|
\usepackage{eukdate}
|
||||||
\usepackage{lipsum}
|
% \usepackage{lipsum}
|
||||||
\usepackage{marvosym}
|
|
||||||
\usepackage{ifthen}
|
\usepackage{ifthen}
|
||||||
\usepackage[svgname]{xcolor}
|
\usepackage[svgname]{xcolor}
|
||||||
|
|
||||||
|
|
||||||
|
%% print if not empty
|
||||||
|
\def\pine#1{\def\test{#1}\ifx\test\empty\relax\else #1\fi}
|
||||||
|
%% print #2 if not empty.
|
||||||
|
\def\pinex#1#2{\ifx#1\empty\relax\else #2\fi}
|
||||||
|
|
||||||
%% Language
|
%% Language
|
||||||
\newcommand{\en}[1]{}
|
\def\en #1{}
|
||||||
\newcommand{\fr}[1]{}
|
\def\fr #1{}
|
||||||
|
|
||||||
|
%% If strings are equal. Syntax:
|
||||||
\ifthenelse{\equal{\locale}{en}}{
|
\ifthenelse{\equal{\locale}{en}}{
|
||||||
\renewcommand{\en}[1]{#1}}{}
|
\def\en #1{#1}}{}
|
||||||
|
|
||||||
\ifthenelse{\equal{\locale}{fr}}{
|
\ifthenelse{\equal{\locale}{fr}}{
|
||||||
\renewcommand{\fr}[1]{#1}}{}
|
\def\fr #1{#1}}{}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
%% Gender commands.
|
%% Gender commands.
|
||||||
\newcommand{\male}[1]{}
|
\def\male #1{}
|
||||||
\newcommand{\female}[1]{}
|
\def\female #1{}
|
||||||
|
\def\org #1{}
|
||||||
|
|
||||||
\ifthenelse{\equal{\gender}{male}}{
|
\ifthenelse{\equal{\gender}{male}}{
|
||||||
\renewcommand{\male}[1]{#1}
|
\def\male #1{#1}}{}
|
||||||
}{}
|
|
||||||
\ifthenelse{\equal{\gender}{female}}{
|
\ifthenelse{\equal{\gender}{female}}{
|
||||||
\renewcommand{\female}[1]{#1}
|
\def\female #1{#1}}{}
|
||||||
}
|
|
||||||
|
\ifthenelse{\equal{\gender}{org}}{
|
||||||
|
\def\org #1{#1}}{}
|
||||||
|
|
||||||
\def\civility{%
|
\def\civility{%
|
||||||
\en{\male{M.}\female{Ms.}}%
|
\en{\male{M.}\female{Mrs.}}%
|
||||||
\fr{\male{Monsieur}\female{Madame}}%
|
\fr{\male{Monsieur}\female{Madame}}%
|
||||||
}
|
}
|
||||||
|
|
||||||
%% Greetings toggle.
|
%% Greetings toggle.
|
||||||
\newcommand{\greetings}[1]{}
|
\def\greetings #1{}
|
||||||
\ifthenelse{\equal{\gender}{}}{}
|
\ifthenelse{
|
||||||
{\renewcommand{\greetings}[1]{#1}}
|
\equal{\gender}{org}
|
||||||
|
}{}{\def\greetings #1{#1}}
|
||||||
|
|
||||||
|
|
||||||
%% Compilation options
|
%% Compilation options
|
||||||
\usepackage{ifpdf}
|
\usepackage{ifpdf}
|
||||||
\ifpdf
|
\ifpdf
|
||||||
\usepackage[pdftex]{graphicx}
|
\usepackage[pdftex]{graphicx}
|
||||||
\else
|
\else
|
||||||
\usepackage[dvips]{graphicx}
|
\usepackage[dvips]{graphicx}
|
||||||
\fi
|
\fi
|
||||||
|
|
||||||
%% Babel
|
%% Babel
|
||||||
|
@ -126,16 +133,15 @@
|
||||||
%% Day-of-week translation
|
%% Day-of-week translation
|
||||||
\makeatletter
|
\makeatletter
|
||||||
\fr{
|
\fr{
|
||||||
\renewcommand\weekday{%
|
\renewcommand\weekday{%
|
||||||
\ifcase\theeuk@date Samedi\or Dimanche\or Lundi\or
|
\ifcase\theeuk@date Samedi\or Dimanche\or Lundi\or
|
||||||
Mardi\or Mercredi\or Jeudi\or Vendredi\fi}
|
Mardi\or Mercredi\or Jeudi\or Vendredi\fi}
|
||||||
|
\newcommand\weekdaylower{%
|
||||||
|
\ifcase\theeuk@date samedi\or dimanche\or lundi\or
|
||||||
|
mardi\or mercredi\or jeudi\or vendredi\fi}
|
||||||
}
|
}
|
||||||
\newcommand\weekdaylower{%
|
|
||||||
\ifcase\theeuk@date samedi\or dimanche\or lundi\or
|
|
||||||
mardi\or mercredi\or jeudi\or vendredi\fi}
|
|
||||||
\makeatother
|
\makeatother
|
||||||
|
|
||||||
|
|
||||||
%% Layout
|
%% Layout
|
||||||
\usepackage[scale=0.8]{geometry}
|
\usepackage[scale=0.8]{geometry}
|
||||||
% \en{\setlength{\parindent}{0pt}}
|
% \en{\setlength{\parindent}{0pt}}
|
||||||
|
@ -148,39 +154,45 @@ mardi\or mercredi\or jeudi\or vendredi\fi}
|
||||||
\newlength{\mpwidth}
|
\newlength{\mpwidth}
|
||||||
\addtolength{\mpwidth}{0.4\textwidth}
|
\addtolength{\mpwidth}{0.4\textwidth}
|
||||||
|
|
||||||
|
%% Remove page number
|
||||||
\pagestyle{empty}
|
\pagestyle{empty}
|
||||||
|
|
||||||
%% Fonts
|
%% Fonts
|
||||||
\renewcommand{\familydefault}{\sfdefault}
|
\renewcommand{\familydefault}{\sfdefault}
|
||||||
|
|
||||||
\let\emphtemp\emph
|
%% \let\emphtemp\emph
|
||||||
\renewcommand{\emph}{{\rm\emphtemp}}
|
%% \renewcommand{\emph}[1]{{\rm\emphtemp{#1}}}
|
||||||
|
|
||||||
|
\let\latextemp\LaTeX
|
||||||
|
\renewcommand{\LaTeX}{{\rm \latextemp}}
|
||||||
|
|
||||||
|
\let\textemp\TeX
|
||||||
|
\renewcommand{\TeX}{{\rm \textemp}}
|
||||||
|
|
||||||
%% PDF Metadata
|
%% PDF Metadata
|
||||||
\ifpdf
|
\ifpdf
|
||||||
\usepackage[]{hyperref}
|
\usepackage[]{hyperref}
|
||||||
\hypersetup{
|
\hypersetup{
|
||||||
pdfauthor = \FileAuthor,
|
pdfauthor = \FileAuthor,
|
||||||
pdftitle = \FileTitle,
|
pdftitle = \FileTitle,
|
||||||
pdfsubject = \FileSubject,
|
pdfsubject = \FileSubject,
|
||||||
pdfkeywords = \FileKeyWords,
|
%% pdfkeywords = \FileKeyWords,
|
||||||
pdfcreator = \LaTeX,
|
pdfcreator = \LaTeX,
|
||||||
pdfproducer = \LaTeX,
|
pdfproducer = \LaTeX,
|
||||||
pdftex,
|
pdftex,
|
||||||
pdfborder=0,
|
pdfborder=0,
|
||||||
breaklinks,
|
breaklinks,
|
||||||
baseurl=http://,
|
baseurl=http://,
|
||||||
pdfpagemode=None,
|
pdfpagemode=None,
|
||||||
pdfstartview=XYZ,
|
pdfstartview=XYZ,
|
||||||
pdfstartpage=1,
|
pdfstartpage=1,
|
||||||
colorlinks=true,
|
colorlinks=true,
|
||||||
urlcolor=black
|
urlcolor=black
|
||||||
}
|
}
|
||||||
\else
|
\else
|
||||||
\usepackage[dvips]{hyperref}
|
\usepackage[dvips]{hyperref}
|
||||||
\fi
|
\fi
|
||||||
|
|
||||||
|
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
\begin{document}
|
\begin{document}
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
@ -191,17 +203,18 @@ mardi\or mercredi\or jeudi\or vendredi\fi}
|
||||||
|
|
||||||
\en{\hfill}
|
\en{\hfill}
|
||||||
\begin{minipage}{\mpwidth}
|
\begin{minipage}{\mpwidth}
|
||||||
%~ \en{\raggedleft}%
|
\edef\fullname{\firstname{} \familyname{}}
|
||||||
%~ \fr{\raggedright}%
|
\pinex{\fullname}{{\bfseries \fullname}
|
||||||
{\bfseries \firstname{} \familyname}
|
\vspace{0.5em}\\\\
|
||||||
\vspace{0.5em}\newline
|
}
|
||||||
\small\itshape%
|
\small\itshape%
|
||||||
\street \newline
|
\pinex{\street}{\street \\\\}
|
||||||
\postcode\ \city\ -- \country{}
|
\pinex{\city}{\postcode{} \city\pinex{\country}{ -- \country{}}
|
||||||
\vspace{0.5em}\newline
|
\vspace{0.5em}\\\\
|
||||||
\Mobilefone~\mobile \newline
|
}
|
||||||
\Telefon~\phone \newline
|
\pinex{\mobile}{\Mobilefone~\mobile \\\\}
|
||||||
\Letter~\href{mailto:\mail}{\mail}
|
\pinex{\phone}{\Telefon~\phone \\\\}
|
||||||
|
\pinex{\mail}{\Letter~\href{mailto:\mail}{\mail}}
|
||||||
\end{minipage}
|
\end{minipage}
|
||||||
\vspace{\baselineskip}
|
\vspace{\baselineskip}
|
||||||
|
|
||||||
|
@ -209,49 +222,58 @@ mardi\or mercredi\or jeudi\or vendredi\fi}
|
||||||
%% Recipient particulars
|
%% Recipient particulars
|
||||||
%%==============================================================================
|
%%==============================================================================
|
||||||
|
|
||||||
\en{}
|
\en{\noindent}%
|
||||||
\fr{\hfill}
|
\fr{\hfill}%
|
||||||
\begin{minipage}{\mpwidth}
|
\begin{minipage}{\mpwidth}
|
||||||
{\bfseries \civility{} \recipientfirstname{} \recipientfamilyname}
|
\edef\recipientfullname{\recipientfirstname{} \recipientfamilyname}
|
||||||
\vspace{0.5em}\newline
|
\pinex{\fullname}{{\bfseries \recipientfullname}
|
||||||
\recipientinstitute{}
|
\\\\[0.5\baselineskip]
|
||||||
\vspace{0.5em}\newline
|
}
|
||||||
{\small\itshape
|
\pinex{\recipientinstitute}{\recipientinstitute{}
|
||||||
\recipientstreet{} \newline
|
\\\\[0.5\baselineskip]
|
||||||
\recipientpostcode{} \recipientcity{} \newline
|
}
|
||||||
}
|
\pinex{\recipientcity}{
|
||||||
|
{\small\itshape
|
||||||
|
\recipientstreet{} \\\\
|
||||||
|
\pine{\recipientpostcode} \recipientcity{} \\\\
|
||||||
|
}
|
||||||
|
}
|
||||||
\end{minipage}
|
\end{minipage}
|
||||||
|
|
||||||
%%==============================================================================
|
%%==============================================================================
|
||||||
%% Date
|
%% Date
|
||||||
%%==============================================================================
|
%%==============================================================================
|
||||||
|
|
||||||
|
\vfill
|
||||||
\vspace{1em}
|
\vspace{1em}
|
||||||
|
|
||||||
\hfill
|
\hfill
|
||||||
\begin{minipage}{\mpwidth}
|
\begin{minipage}{\mpwidth}
|
||||||
\en{\today}
|
\en{\today}
|
||||||
\fr{\city, le \weekdaylower\ \today}
|
\fr{\city, le \weekdaylower\ \today}
|
||||||
\end{minipage}\newline%[2em]
|
\end{minipage}\\\\
|
||||||
|
|
||||||
%%==============================================================================
|
%%==============================================================================
|
||||||
%% Object
|
%% Object
|
||||||
%%==============================================================================
|
%%==============================================================================
|
||||||
% \noindent
|
\pinex{\subject}{
|
||||||
% \textbf{\en{Object}\fr{Objet}~:}
|
\noindent
|
||||||
% This is my object.\newline\vspace{\baselineskip}
|
\textbf{\en{Object}\fr{Objet}~:}
|
||||||
|
\subject{}.
|
||||||
|
\vspace{1\baselineskip}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
%%==============================================================================
|
%%==============================================================================
|
||||||
%% Content
|
%% Content
|
||||||
%%==============================================================================
|
%%==============================================================================
|
||||||
\greetings{
|
\greetings{
|
||||||
\en{Dear}\fr{\male{Cher}\female{Chère}} \civility{} \recipientfamilyname,\newline
|
\en{Dear}\fr{\male{Cher}\female{Chère}} \civility{} \recipientfamilyname,
|
||||||
}
|
}
|
||||||
|
|
||||||
\lipsum[1]
|
\noindent
|
||||||
|
Common blah.
|
||||||
Thanks for your consideration; I am looking forward to hearing from you soon!
|
I thank you for your consideration; I am looking forward to hearing from you soon!
|
||||||
|
|
||||||
%%==============================================================================
|
%%==============================================================================
|
||||||
%% Closing
|
%% Closing
|
||||||
|
@ -260,18 +282,19 @@ Thanks for your consideration; I am looking forward to hearing from you soon!
|
||||||
\vfill
|
\vfill
|
||||||
|
|
||||||
\en{
|
\en{
|
||||||
Yours sincerely,
|
Best regards.
|
||||||
|
%% Yours sincerely,
|
||||||
}
|
}
|
||||||
\fr{
|
\fr{
|
||||||
%~ Cordialement,
|
%% Cordialement,
|
||||||
Veuillez agréer, \civility{}, l'expression de mes sentiments les meilleurs.
|
Veuillez agréer, \civility{}, l'expression de mes sentiments les meilleurs.
|
||||||
}
|
}
|
||||||
|
|
||||||
\vspace{1em}
|
\vspace{\baselineskip}
|
||||||
\hfill
|
\hfill
|
||||||
\begin{minipage}{\mpwidth}
|
\begin{minipage}{\mpwidth}
|
||||||
\textbf{\firstname\ \familyname}\newline
|
\textbf{\firstname\ \familyname}\newline
|
||||||
%\includegraphics[scale=0.75]{signature_blue}
|
%\includegraphics[scale=0.75]{signature_blue}
|
||||||
\end{minipage}
|
\end{minipage}
|
||||||
|
|
||||||
%%==============================================================================
|
%%==============================================================================
|
||||||
|
@ -280,9 +303,10 @@ Veuillez agréer, \civility{}, l'expression de mes sentiments les meilleurs.
|
||||||
|
|
||||||
\vfill
|
\vfill
|
||||||
|
|
||||||
\noindent\em
|
%% \noindent{\em
|
||||||
\fr{Ci-joint~: Curriculum Vit\ae}
|
%% \fr{Ci-joint~: Curriculum Vitæ}
|
||||||
\en{Attachment: Curriculum Vit\ae}
|
%% \en{Attachment: Curriculum Vit\ae}
|
||||||
|
%% }
|
||||||
|
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
\end{document}
|
\end{document}
|
||||||
|
|
30
.homeinit
30
.homeinit
|
@ -1,10 +1,10 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
################################################################################
|
################################################################################
|
||||||
## Home session initialization.
|
## Home session initialization.
|
||||||
## 2012-04-28
|
## 2012-09-09
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
## Fetch from Git repo:
|
## Fetch source from Git repo:
|
||||||
# cd
|
# cd
|
||||||
# git init
|
# git init
|
||||||
# git remote add origin https://github.com/Ambrevar/home-config.git
|
# git remote add origin https://github.com/Ambrevar/home-config.git
|
||||||
|
@ -12,6 +12,9 @@
|
||||||
# git branch master origin/master
|
# git branch master origin/master
|
||||||
# git checkout master
|
# git checkout master
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
## The following is used as first-run setup.
|
||||||
|
|
||||||
SOURCEDIR="${HOME}/Dropbox/Personal"
|
SOURCEDIR="${HOME}/Dropbox/Personal"
|
||||||
|
|
||||||
## Mutt
|
## Mutt
|
||||||
|
@ -37,9 +40,28 @@ echo
|
||||||
## rtorrent
|
## rtorrent
|
||||||
echo "==> rtorrent"
|
echo "==> rtorrent"
|
||||||
mkdir -p "${HOME}/.session"
|
mkdir -p "${HOME}/.session"
|
||||||
|
echo
|
||||||
|
|
||||||
## Luakit -- Fetch Adblock list.
|
## Luakit -- Fetch Adblock list.
|
||||||
|
## This is handy to update lists regularly.
|
||||||
echo "==> Luakit"
|
echo "==> Luakit"
|
||||||
mkdir -p "$XDG_DATA_HOME/luakit"
|
|
||||||
wget 'https://easylist-downloads.adblockplus.org/easylist.txt' -O "$XDG_DATA_HOME/luakit/easylist.txt"
|
|
||||||
|
|
||||||
|
# Update the adblock modules
|
||||||
|
git clone https://github.com/Plaque-fcc/luakit-adblock/ "${HOME}/luakit-adblock"
|
||||||
|
cp -fv ~/luakit-adblock/*.lua "$XDG_CONFIG_HOME/luakit"
|
||||||
|
rm -rvf "$HOME/luakit-adblock"
|
||||||
|
|
||||||
|
# Update the adblock lists
|
||||||
|
mkdir -p "$XDG_DATA_HOME/luakit/adblock"
|
||||||
|
wget https://easylist-downloads.adblockplus.org/easylist.txt \
|
||||||
|
https://easylist-downloads.adblockplus.org/easyprivacy.txt \
|
||||||
|
https://easylist-downloads.adblockplus.org/easylistgermany.txt \
|
||||||
|
http://lian.info.tm/liste_fr.txt \
|
||||||
|
-P "$XDG_DATA_HOME/luakit/adblock"
|
||||||
|
# https://adblock-chinalist.googlecode.com/svn/trunk/adblock.txt # ChinaList
|
||||||
|
# https://easylist-downloads.adblockplus.org/easylistitaly.txt
|
||||||
|
# https://dutchadblockfilters.googlecode.com/svn/trunk/AdBlock_Dutch_hide.txt
|
||||||
|
# http://stanev.org/abp/adblock_bg.txt # Bulgarian List
|
||||||
|
# https://indonesianadblockrules.googlecode.com/hg/subscriptions/abpindo.txt # AB Pindo (Indonesian)
|
||||||
|
|
||||||
|
echo
|
||||||
|
|
|
@ -49,8 +49,8 @@ feh
|
||||||
fftw
|
fftw
|
||||||
file
|
file
|
||||||
filesystem
|
filesystem
|
||||||
|
finch
|
||||||
findutils
|
findutils
|
||||||
firefox
|
|
||||||
flashplugin
|
flashplugin
|
||||||
flex
|
flex
|
||||||
fortune-mod
|
fortune-mod
|
||||||
|
@ -61,11 +61,9 @@ gcc-libs
|
||||||
gcolor2
|
gcolor2
|
||||||
gdb
|
gdb
|
||||||
gettext
|
gettext
|
||||||
gimp
|
|
||||||
git
|
git
|
||||||
glibc
|
glibc
|
||||||
gnu-netcat
|
gnu-netcat
|
||||||
gparted
|
|
||||||
graphicsmagick
|
graphicsmagick
|
||||||
grep
|
grep
|
||||||
gsasl
|
gsasl
|
||||||
|
@ -75,7 +73,6 @@ gstreamer0.10-ffmpeg
|
||||||
gstreamer0.10-good
|
gstreamer0.10-good
|
||||||
gstreamer0.10-python
|
gstreamer0.10-python
|
||||||
gzip
|
gzip
|
||||||
handbrake
|
|
||||||
hdparm
|
hdparm
|
||||||
heirloom-mailx
|
heirloom-mailx
|
||||||
highlight
|
highlight
|
||||||
|
@ -88,11 +85,9 @@ ifplugd
|
||||||
indent
|
indent
|
||||||
inetutils
|
inetutils
|
||||||
initscripts
|
initscripts
|
||||||
inkscape
|
|
||||||
iotop
|
iotop
|
||||||
iptables
|
iptables
|
||||||
iputils
|
iputils
|
||||||
isomaster
|
|
||||||
ispell
|
ispell
|
||||||
jfsutils
|
jfsutils
|
||||||
khrplatform-devel
|
khrplatform-devel
|
||||||
|
@ -171,7 +166,6 @@ pdksh
|
||||||
perl
|
perl
|
||||||
perl-digest-sha1
|
perl-digest-sha1
|
||||||
perl-locale-gettext
|
perl-locale-gettext
|
||||||
pidgin
|
|
||||||
pkg-config
|
pkg-config
|
||||||
pkgfile
|
pkgfile
|
||||||
pkgstats
|
pkgstats
|
||||||
|
|
|
@ -13,14 +13,12 @@ aspell-en
|
||||||
aspell-fr
|
aspell-fr
|
||||||
ati-dri
|
ati-dri
|
||||||
atk
|
atk
|
||||||
atkmm
|
|
||||||
atool
|
atool
|
||||||
attr
|
attr
|
||||||
autoconf
|
autoconf
|
||||||
automake
|
automake
|
||||||
avahi
|
avahi
|
||||||
awesome
|
awesome
|
||||||
babl
|
|
||||||
bash
|
bash
|
||||||
bash-completion
|
bash-completion
|
||||||
bc
|
bc
|
||||||
|
@ -29,7 +27,6 @@ bison
|
||||||
bzip2
|
bzip2
|
||||||
ca-certificates
|
ca-certificates
|
||||||
cairo
|
cairo
|
||||||
cairomm
|
|
||||||
calc
|
calc
|
||||||
ccrypt
|
ccrypt
|
||||||
cdparanoia
|
cdparanoia
|
||||||
|
@ -82,8 +79,8 @@ ffmpeg
|
||||||
fftw
|
fftw
|
||||||
file
|
file
|
||||||
filesystem
|
filesystem
|
||||||
|
finch
|
||||||
findutils
|
findutils
|
||||||
firefox
|
|
||||||
fixesproto
|
fixesproto
|
||||||
flac
|
flac
|
||||||
flashplugin
|
flashplugin
|
||||||
|
@ -104,26 +101,22 @@ gd
|
||||||
gdb
|
gdb
|
||||||
gdbm
|
gdbm
|
||||||
gdk-pixbuf2
|
gdk-pixbuf2
|
||||||
gegl
|
|
||||||
geoclue
|
geoclue
|
||||||
gettext
|
gettext
|
||||||
ghostscript
|
ghostscript
|
||||||
giblib
|
giblib
|
||||||
giflib
|
giflib
|
||||||
gimp
|
|
||||||
girara-common
|
girara-common
|
||||||
girara-gtk2
|
girara-gtk2
|
||||||
git
|
git
|
||||||
glib2
|
glib2
|
||||||
glibc
|
glibc
|
||||||
glibmm
|
|
||||||
glib-networking
|
glib-networking
|
||||||
glproto
|
glproto
|
||||||
gmp
|
gmp
|
||||||
gnu-netcat
|
gnu-netcat
|
||||||
gnupg
|
gnupg
|
||||||
gnutls
|
gnutls
|
||||||
gparted
|
|
||||||
gpgme
|
gpgme
|
||||||
gpm
|
gpm
|
||||||
graphicsmagick
|
graphicsmagick
|
||||||
|
@ -133,7 +126,6 @@ groff
|
||||||
gsasl
|
gsasl
|
||||||
gsettings-desktop-schemas
|
gsettings-desktop-schemas
|
||||||
gsfonts
|
gsfonts
|
||||||
gsl
|
|
||||||
gsm
|
gsm
|
||||||
gstreamer0.10
|
gstreamer0.10
|
||||||
gstreamer0.10-bad
|
gstreamer0.10-bad
|
||||||
|
@ -143,12 +135,9 @@ gstreamer0.10-ffmpeg
|
||||||
gstreamer0.10-good
|
gstreamer0.10-good
|
||||||
gstreamer0.10-python
|
gstreamer0.10-python
|
||||||
gtk2
|
gtk2
|
||||||
gtkmm
|
|
||||||
gtkspell
|
|
||||||
gtk-update-icon-cache
|
gtk-update-icon-cache
|
||||||
gts
|
gts
|
||||||
gzip
|
gzip
|
||||||
handbrake
|
|
||||||
hdparm
|
hdparm
|
||||||
heirloom-mailx
|
heirloom-mailx
|
||||||
hicolor-icon-theme
|
hicolor-icon-theme
|
||||||
|
@ -169,14 +158,12 @@ imlib2
|
||||||
indent
|
indent
|
||||||
inetutils
|
inetutils
|
||||||
initscripts
|
initscripts
|
||||||
inkscape
|
|
||||||
inputproto
|
inputproto
|
||||||
iotop
|
iotop
|
||||||
iproute2
|
iproute2
|
||||||
iptables
|
iptables
|
||||||
iputils
|
iputils
|
||||||
isl
|
isl
|
||||||
isomaster
|
|
||||||
ispell
|
ispell
|
||||||
iw
|
iw
|
||||||
jack
|
jack
|
||||||
|
@ -280,7 +267,6 @@ librsvg
|
||||||
libsamplerate
|
libsamplerate
|
||||||
libsasl
|
libsasl
|
||||||
libsigc++
|
libsigc++
|
||||||
libsigsegv
|
|
||||||
libsm
|
libsm
|
||||||
libsndfile
|
libsndfile
|
||||||
libsoup
|
libsoup
|
||||||
|
@ -399,7 +385,6 @@ pacman-mirrorlist
|
||||||
pam
|
pam
|
||||||
pambase
|
pambase
|
||||||
pango
|
pango
|
||||||
pangomm
|
|
||||||
pari
|
pari
|
||||||
parted
|
parted
|
||||||
patch
|
patch
|
||||||
|
@ -411,7 +396,6 @@ perl
|
||||||
perl-digest-sha1
|
perl-digest-sha1
|
||||||
perl-error
|
perl-error
|
||||||
perl-locale-gettext
|
perl-locale-gettext
|
||||||
pidgin
|
|
||||||
pinentry
|
pinentry
|
||||||
pixman
|
pixman
|
||||||
pkg-config
|
pkg-config
|
||||||
|
@ -485,7 +469,6 @@ systemd
|
||||||
sysvbanner
|
sysvbanner
|
||||||
sysvinit
|
sysvinit
|
||||||
sysvinit-tools
|
sysvinit-tools
|
||||||
t1lib
|
|
||||||
talloc
|
talloc
|
||||||
tar
|
tar
|
||||||
task
|
task
|
||||||
|
@ -576,4 +559,3 @@ zathura-ps
|
||||||
zip
|
zip
|
||||||
zlib
|
zlib
|
||||||
zsh
|
zsh
|
||||||
zziplib
|
|
||||||
|
|
10
.save
10
.save
|
@ -135,10 +135,8 @@ do
|
||||||
done
|
done
|
||||||
|
|
||||||
## Awesome
|
## Awesome
|
||||||
for i in $(find .config/awesome \( -name "*.lua" -o -name "*.sh" \) -type f)
|
FILELIST=(${FILELIST[*]} ".config/awesome/rc.lua")
|
||||||
do
|
FILELIST=(${FILELIST[*]} ".config/awesome/themes/custom/theme.lua")
|
||||||
FILELIST=(${FILELIST[*]} "$i")
|
|
||||||
done
|
|
||||||
|
|
||||||
## cmus
|
## cmus
|
||||||
FILELIST=(${FILELIST[*]} ".cmus/autosave")
|
FILELIST=(${FILELIST[*]} ".cmus/autosave")
|
||||||
|
@ -163,7 +161,9 @@ FILELIST=(${FILELIST[*]} ".gitconfig")
|
||||||
FILELIST=(${FILELIST[*]} ".homeinit")
|
FILELIST=(${FILELIST[*]} ".homeinit")
|
||||||
|
|
||||||
## Luakit
|
## Luakit
|
||||||
FILELIST=(${FILELIST[*]} ".config/luakit/")
|
FILELIST=(${FILELIST[*]} ".config/luakit/rc.lua")
|
||||||
|
FILELIST=(${FILELIST[*]} ".config/luakit/binds.lua")
|
||||||
|
FILELIST=(${FILELIST[*]} ".config/luakit/globals.lua")
|
||||||
|
|
||||||
## Mutt
|
## Mutt
|
||||||
FILELIST=(${FILELIST[*]} ".muttrc")
|
FILELIST=(${FILELIST[*]} ".muttrc")
|
||||||
|
|
8
README
8
README
|
@ -63,7 +63,7 @@ snippets). Some custom functions (duplicate line, unfill-paragraph, etc.).
|
||||||
Luakit
|
Luakit
|
||||||
******
|
******
|
||||||
Some custom bindings, download location, search engines, etc. Script+Plugin
|
Some custom bindings, download location, search engines, etc. Script+Plugin
|
||||||
toggle.
|
toggle. Adblock script (must be downloaded manually or from .homeinit).
|
||||||
|
|
||||||
Mutt
|
Mutt
|
||||||
****
|
****
|
||||||
|
@ -135,8 +135,7 @@ Known issues
|
||||||
|
|
||||||
Emacs: some colors do not work as intended.
|
Emacs: some colors do not work as intended.
|
||||||
|
|
||||||
Luakit: adblock makes Luakit crash whenever easylist.txt is not found.
|
Luakit: Adblock will not always block ads correctly.
|
||||||
adblock will not always work.
|
|
||||||
|
|
||||||
Ranger: if editor is 'emacsclient -t -a""', it will not show up if emacs daemon
|
Ranger: if editor is 'emacsclient -t -a""', it will not show up if emacs daemon
|
||||||
is not running.
|
is not running.
|
||||||
|
@ -168,6 +167,7 @@ calc
|
||||||
catdvi
|
catdvi
|
||||||
ccrypt
|
ccrypt
|
||||||
cdrtools
|
cdrtools
|
||||||
|
centerim
|
||||||
chrpath
|
chrpath
|
||||||
cmus
|
cmus
|
||||||
column
|
column
|
||||||
|
@ -188,6 +188,7 @@ fdisk
|
||||||
feh
|
feh
|
||||||
ffmpeg
|
ffmpeg
|
||||||
file
|
file
|
||||||
|
finch
|
||||||
fmt
|
fmt
|
||||||
fortune
|
fortune
|
||||||
gcolor2
|
gcolor2
|
||||||
|
@ -240,7 +241,6 @@ p7zip
|
||||||
pari
|
pari
|
||||||
parted
|
parted
|
||||||
patch
|
patch
|
||||||
pidgin
|
|
||||||
poppler
|
poppler
|
||||||
pstotext
|
pstotext
|
||||||
pwgen
|
pwgen
|
||||||
|
|
Loading…
Reference in New Issue