Skip to content

Instantly share code, notes, and snippets.

Bruno Meneguello bkmeneguello

View GitHub Profile
@bkmeneguello
bkmeneguello / createLocalhostCert.sh
Created Apr 23, 2019
Generate a "localhost" valid certificate
View createLocalhostCert.sh
openssl req -x509 -out localhost.crt -keyout localhost.key \
-newkey rsa:2048 -nodes -sha256 \
-subj '/CN=localhost' -extensions EXT -config <( \
printf "[dn]\nCN=localhost\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:localhost\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth")
View gist:995913ed872a66343717cc5dd0e7dd5b
gpg --gen-key
git config --global user.signingkey <KEY>
git config --global commit.gpgsign true
View gist:6f78ea804337edd1c3d88ed2b1dc2bdc
pem2openpgp "Name Surname <email@something>" < mykey.pem | gpg --import
View gist:54a84b678e05ec706b54a6239ef2e829
# host
apt-get install apt-cacher-ng
# dockerfile
ARG APT_CACHE
RUN [ ! -z "$APT_CACHE" ] && echo "Acquire::http::Proxy \"http://$APT_CACHE\";" > /etc/apt/apt.conf.d/30proxy ||:
# docker build
docker build --build-arg APT_CACHE=$HOST_IP:3142 .
@bkmeneguello
bkmeneguello / gist:c29da541d3183c26c792d628a46ad826
Created Dec 18, 2017
Raspberry Pi Docker "cgroups: memory cgroup not supported on this system"
View gist:c29da541d3183c26c792d628a46ad826
echo -n " cgroup_memory=1 swapaccount=1" >> /boot/cmdline.txt
View gist:f624323e238280c4e0a682cc03f0ee7f
vi /etc/sudoers.d/nopasswd
%sudo ALL = (ALL) NOPASSWD: ALL
@bkmeneguello
bkmeneguello / passwordless polkit
Created Dec 6, 2017
Avoid GUI password prompt
View passwordless polkit
vi /var/lib/polkit-1/localauthority/50-local.d/disable-passwords.pkla
[Do anything you want]
Identity=unix-group:sudo
Action=*
ResultActive=yes
View dictget.py
dictget = lambda d, *k: [d[i] for i in k]
'''
usage: v1, v2, vN = dictget(<dict>, 'key1', 'key2', 'keyN')
'''
View delicious-parser.py
#!/usr/bin/python
import json
from HTMLParser import HTMLParser
class MyHTMLParser(HTMLParser):
def __init__(self):
HTMLParser.__init__(self)
self.on_dt = False
self.on_dd = False
View upholdBot.py
from uphold import Uphold
from time import sleep, time
from tinydb import TinyDB
api = Uphold()
api.auth_pat(<PAT_KEY>)
db = TinyDB('/tmp/db.json')
usd_card = <USD_CARD_ID>
You can’t perform that action at this time.