Skip to content

Instantly share code, notes, and snippets.

View zigarn's full-sized avatar
🇫🇷
⁉️ 🅰️ 🐍 🐳 ☸️ ☯️

Alexandre Garnier zigarn

🇫🇷
⁉️ 🅰️ 🐍 🐳 ☸️ ☯️
View GitHub Profile
@zigarn
zigarn / filters.txt
Created July 16, 2023 06:30
Ad blocker filters
theoldreader.com###banner_container
theoldreader.com##div#in-feed-ad-container
theoldreader.com###tor-in-feed-ad-container
{
"basics": {
"name": "Alexandre Garnier",
"label": "IT Consultant",
"picture": "https://www.zigarn.com/avatar.jpg",
"website": "https://www.zigarn.com",
"summary": "IT consultant & trainer. DevOps thinking addict.",
"location": {
"city": "Paris",
"countryCode": "FR"
@zigarn
zigarn / Vagrantfile
Last active July 29, 2018 08:23
Vagrantfile mDNS
# -*- mode: ruby -*-
# vi: set ft=ruby expandtab shiftwidth=2 :
# Add time logging
def $stdout.write string
log_datas=string
if log_datas.gsub(/\r?\n/, '') != ''
log_datas=::Time.now.strftime('%FT%T%z')+' '+log_datas.gsub(/\r\n/, '\n')
end
super log_datas
@zigarn
zigarn / 01-docker-tls.sh
Last active October 30, 2022 08:42
Generate Docker certificates for training on TLS
# Configuration
export PUBLIC_DNS=<public hostname>
export PUBLIC_IP=<public host IP>
export PRIVATE_IP=<private host IP>
mkdir docker-ca
chmod 0700 docker-ca/
cd docker-ca/
# CA key
@zigarn
zigarn / Windows_symlink.md
Last active September 7, 2020 07:00
Enable Symlink in Windows
#!/bin/sh
git init --q repo
cd repo
python -c "import random; print '\n'.join([' '.join([word.replace('\n', '') for word in random.sample(list(open('/usr/share/dict/words')), 10)]) for _ in range(50)])" >> file
git add file
git commit -qm "Initial commit"
sed -i '15s/[eiouy]/a/' file
git commit -aqm "Change line 15 on master"
git ls-tree -r HEAD^{tree} \ # list files
| grep -v '^120000 ' \ # ignore symlinks
| cut -d " " -f 3- \ # remove columns 1 and 2 (mode and type)
| sort -k1 -k2 \ # sort
| awk 'BEGIN { FS = " " } { count[$1]++; if (count[$1] == 1) {first[$1] = $0;}; if (count[$1] == 2) {print "-"; print first[$1];}; if (count[$1] > 1) {print} }' # list duplicates
@zigarn
zigarn / register.py
Last active August 29, 2015 14:04 — forked from nickleefly/register.py
#
# script to register Python 2.6 or later for use with win32all
# and other extensions that require Python registry settings
# written by Joakim Loew for Secret Labs AB / PythonWare
#
# source:
# http://www.pythonware.com/products/works/articles/regpy20.htm
#
# modified by Valentine Gogichashvili as described in http://www.mail-archive.com/distutils-sig@python.org/msg10512.html
# modified by Alexandre Garnier to also work for Python 3
select
src_cc.owner as src_owner, src_cc.table_name as src_table, src_cc.column_name as src_column,
dest_cc.owner as dest_owner, dest_cc.table_name as dest_table, dest_cc.column_name as dest_column,
c.constraint_name
from
all_constraints c
inner join all_cons_columns dest_cc on c.r_constraint_name = dest_cc.constraint_name and c.r_owner = dest_cc.owner
inner join all_cons_columns src_cc on c.constraint_name = src_cc.constraint_name and c.owner = src_cc.owner
where
c.constraint_type = 'R'