Skip to content

Instantly share code, notes, and snippets.

Avatar

Thiago de Arruda Padilha tarruda

View GitHub Profile
@tarruda
tarruda / allow-url-patterns-intercept-protocol.diff
Created Oct 17, 2020
This patch modifies electron's intercept*Protocol APIs to allow passing an array of URL patterns as second argument (same format as webRequest)
View allow-url-patterns-intercept-protocol.diff
commit 6defd383ae86a65a4cdcc8ec47f4aabf7aac69a6
Author: Thiago Padilha <thiagopadilha@cloud.upwork.com>
Date: Fri Oct 16 19:10:26 2020 -0300
OTA-10843: Implement URL patterns for intercept*Protocol
By passing an array of URL patterns (same syntax as webRequest), it is now
possible to filter which URLs are passed to intercept*Protocol handlers.
diff --git a/shell/browser/api/electron_api_protocol_ns.cc b/shell/browser/api/electron_api_protocol_ns.cc
@tarruda
tarruda / msgpack_rpc.py
Created Aug 27, 2018
msgpack-rpc implementation for python asyncio
View msgpack_rpc.py
import asyncio
import collections
import mpack
class ErrorResponse(BaseException):
pass
class MpackRpcSession(object):
def __init__(self, reader, writer, mpack_session=None):
@tarruda
tarruda / userns-with-vpn.xml
Last active May 18, 2018
Libvirt lxc configurations
View userns-with-vpn.xml
<domain type='lxc'>
<name>vpntest</name>
<uuid>ffee008c-ec6b-48ab-af6d-4aba830847a1</uuid>
<memory unit='GiB'>8</memory> <!-- The container can use at most 8G of memory -->
<idmap>
<uid start='0' target='300000' count='65536'/>
<gid start='0' target='300000' count='65536'/>
</idmap>
<os>
<type arch='x86_64'>exe</type>
@tarruda
tarruda / index.html
Created Jun 2, 2017
electron sandbox webview test
View index.html
<html>
<body>
<webview id="foo" allowpopups sandbox="true" preload="preload-webview.js" src="index.html" style="display:inline-flex; width:640px; height:480px"></webview>
<script type="text/javascript" charset="utf-8">
</script>
</body>
</html>
@tarruda
tarruda / pkg-gonfig.go
Created Nov 29, 2015 — forked from mattn/pkg-gonfig.go
go implementation of pkg-config
View pkg-gonfig.go
package main
import (
"io/ioutil"
"os"
"path/filepath"
"regexp"
"strings"
)
@tarruda
tarruda / lxc-autostart.tcl
Last active Dec 14, 2015
Autostart unprivileged lxc containers
View lxc-autostart.tcl
#!/usr/bin/expect
# Workaround to automatically start unprivileged containers on boot. This is
# required because unprivileged containers only seem to work when started from
# an interactive login session. Reference: https://github.com/lxc/lxc/issues/411#issuecomment-71414916)
#
# This script can be called from the user crontab with the @reboot
# directive(runs once at startup). One way to achieve this is to save this
# script to /home/USER/lxc-autostart.tcl and add the following entry to
# `crontab -e`:
@tarruda
tarruda / nvim-terminal-edit.py
Last active Sep 4, 2020
Edit file in host Neovim instance from a :terminal buffer
View nvim-terminal-edit.py
#!/usr/bin/env python
"""Edit a file in the host nvim instance."""
import os
import sys
from neovim import attach
args = sys.argv[1:]
if not args:
print "Usage: {} <filename> ...".format(sys.argv[0])
@tarruda
tarruda / gtk3-pyenv.sh
Created Jan 9, 2015
Install pygtk3 in pyenv
View gtk3-pyenv.sh
#!/bin/bash
# script for pyenv installation of pygtk3 in ubuntu 12.04
# Adapted from https://gist.github.com/mehcode/6172694
system_package_installed() {
if ! dpkg -l | grep -q $1; then
sudo apt-get install $1
fi
}
@tarruda
tarruda / twilight.vim
Created Dec 13, 2014
twilight vim theme
View twilight.vim
hi Normal term=NONE cterm=NONE ctermbg=234 ctermfg=230 gui=NONE guibg=#1a1a1a guifg=#fffedc
hi PreProc term=underline cterm=NONE ctermbg=234 ctermfg=145 gui=NONE guibg=#1a1a1a guifg=#8a9597
hi Type term=underline cterm=NONE ctermbg=234 ctermfg=144 gui=NONE guibg=#1a1a1a guifg=#a2a96f
hi Underlined term=underline cterm=underline ctermbg=234 ctermfg=230 gui=underline guibg=#1a1a1a guifg=#fffedc
hi Ignore term=NONE cterm=NONE ctermbg=bg ctermfg=234 gui=NONE guibg=bg guifg=#1a1a1a
hi Error term=reverse cterm=NONE ctermbg=95 ctermfg=231 gui=NONE guibg=#602020 guifg=#ffffff
hi Todo term=NONE cterm=bold ctermbg=234 ctermfg=145 gui=bold,italic guibg=#1a1a1a guifg=#8a9597
hi String term=NONE cterm=NONE ctermbg=234 ctermfg=80 gui=NONE guibg=#1a1a1a guifg=#4bb5c6
hi SpecialKey term=bold cterm=NONE ctermbg=234 ctermfg=236 gui=NONE guibg=#1a1a1a guifg=#303030
hi NonText term=bold cterm=bold ctermbg=234 ctermfg=102 gui=bold guibg=#1a1a1a guifg=#605958
View tui.c
#include <assert.h>
#include <stdbool.h>
#include <stdio.h>
#include <unistd.h>
#include <termios.h>
#include <termkey.h>
#include <tickit.h>
You can’t perform that action at this time.