Skip to content

Instantly share code, notes, and snippets.

@dnozay
dnozay / _Jenkins+Script+Console.md
Last active Sep 20, 2021
jenkins groovy scripts collection.
View _Jenkins+Script+Console.md
@dnozay
dnozay / README.md
Last active Sep 17, 2021
Collection of useful stuff for interacting with gitlab.
View README.md

Reset root/admin password

Lost the root/admin password? You can reset it using the command-line. Recipe adapted from gitlab issue #308.

# start the console
sudo gitlab-rails console
@dnozay
dnozay / My Exiftool Cheatsheet.md
Last active Sep 13, 2021 — forked from rjames86/My Exiftool Cheatsheet.md
Cheatsheet for image / video metadata manipulation.
View My Exiftool Cheatsheet.md

Cheatsheet for image / video metadata manipulation.

Last updated 2019-07-24

Disclaimer

until more specific license...

THE CONTENT BELOW IS PROVIDED "AS-IS",
WE DISCLAIM LIABILITY FOR ALL USES TO THE FULLEST EXTENT PERMITTED BY APPLICABLE LAW.
@dnozay
dnozay / README
Last active Jun 12, 2021
syslog (port 10514) firewall configuration for vSphere
View README
goal
----
The goal is send syslog traffic to a remote host and use unpriviledged ports;
so that I can have my logstash (http://logstash.net/) server not need to
run as root. On vSphere 5.1, tcp 1514 is covered by the syslog rule, but
in my case udp is preferred.
installation
------------
@dnozay
dnozay / README.md
Created Nov 23, 2014
simple distributed web crawler using flask + scrapy + redis
View README.md

design

Requests are handled by flask, a bunch of urls are inserted in the object store (redis) and arguments are put on the queue (redis again) for workers to consume. More workers would mean more items processed in parallel.

Other possible implementations:

  • multiprocessing module for consuming all cpus.
    • multiprocessing.managers.SyncManager for distributing task to other machines.
@dnozay
dnozay / README.md
Last active May 4, 2021
Enable memberOf attribute on an openldap server.
View README.md
@dnozay
dnozay / main.py
Created Nov 1, 2014
python multi-processing example using initializer function.
View main.py
#!/usr/bin/env python
# This example shows how to use multiprocessing with an initializer function.
# We take advantage of that to make the workers each have a custom initial
# load. And in particular example, we will make the workers sleep.
# Because we make them sleep different amounts, one of them is going to be
# ready much before the others, and thus we can guess easily which worker
# will do most of the work.
#
# see https://stackoverflow.com/questions/26693797/python-multiprocessing-process-number
@dnozay
dnozay / gist:4965322
Created Feb 16, 2013
prettytable and textwrap to format a dictionary (e.g. os.environ)
View gist:4965322
# some simple function that uses prettytable and textwrap to format a dictionary
# http://code.google.com/p/prettytable/wiki/Tutorial
from prettytable import PrettyTable
from textwrap import wrap
VAL_WRAP_WIDTH = 60
def pretty_dictionary(dic):
tab = PrettyTable(['key', 'value'])
@dnozay
dnozay / spy-variable.py
Created Jan 4, 2021
spy on variable in python
View spy-variable.py
# https://stackoverflow.com/a/34620310/1733117
import sys
import dis
import random
watchme = 123
def foo():
global watchme
@dnozay
dnozay / trigger.sql
Created Nov 7, 2014
mysql change value on insert/update
View trigger.sql
-- example mysql triggers that change column values
-- before they are inserted/updated.
-- use case: when building code that comes from a git repository
-- we want to track the branch information, but some of the jobs
-- building the product use references rather than short names.
-- e.g. refs/remotes/origin/my/branch rather than origin/my/branch.
delimiter //