This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def ary(p): | |
f = [0] | |
i = 1 | |
j = 0 | |
while i < len(p): | |
if p[i] == p[j]: | |
f.append(j+1) | |
i = i + 1 | |
j = j + 1 | |
elif j > 0: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hashlib, os, sys, re | |
from os.path import join, getsize | |
def sha512file(file): | |
sha512 = hashlib.sha512() | |
try: | |
f = open(file,"rb") | |
except IOError: | |
print("IO Error, unable to open file", file) | |
while True: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
from __future__ import print_function | |
import json | |
overarch = {} | |
overarch["us"] = [ | |
"kc.example.com", | |
"la.example.net", | |
] | |
overarch["germany"] = ["de.test.net"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Securely generate a hash for ansible | |
# don't paste the password into code at any point in time | |
from __future__ import print_function | |
from passlib.hash import sha256_crypt | |
from getpass import getpass | |
pw = getpass() | |
print(sha256_crypt.encrypt(pw)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Compares 2 WP post tables to find published posts with the same name but different content | |
# Used after merging an old WP install into an existing one | |
import csv, difflib, hashlib, sys | |
file = open(1, encoding='utf-8') | |
main = [row for row in csv.reader(file)] | |
file = open(2, encoding='utf-8') | |
xen = [row for row in csv.reader(file)] | |
# There is no doubt a better way to do this using difflib, but I did this before finding out about it | |
main_posts = {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%global _hardened_build 1 | |
%global nginx_user nginx | |
%global nginx_group %{nginx_user} | |
%global nginx_home %{_localstatedir}/lib/nginx | |
%global nginx_home_tmp %{nginx_home}/tmp | |
%global nginx_confdir %{_sysconfdir}/nginx | |
%global nginx_datadir %{_datadir}/nginx | |
%global nginx_logdir %{_localstatedir}/log/nginx | |
%global nginx_webroot %{nginx_datadir}/html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
listen [::]:80; | |
server_name {{item.key}}; | |
root /var/www/{{item.key}}; | |
index index.html index.htm index.php; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- - include: | |
- domain: org.apache.cassandra.metrics | |
- type: ClientRequest | |
- attribute: | |
- Count: | |
- #metric_type: counter | |
- metric_type: gauge | |
- alias: cassandra.metrics.client_request.count | |
- 50thPercentile: | |
- metric_type: gauge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
AWSTemplateFormatVersion: 2010-09-09 | |
Description: Calligre Lambda CF Stack | |
Resources: | |
ImagePendingResizeBucket: | |
Type: AWS::S3::Bucket | |
Properties: | |
AccessControl: Private | |
NotificationConfiguration: | |
LambdaConfigurations: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# connect to db using mysql | |
$ mysql | |
MariaDB [(none)]> use zen_gallery_db; | |
MariaDB [zen_gallery_db]> select value from zp_options where name = 'extra_auth_hash_text'; | |
(keep this value!) | |
# separate python process | |
import hashlib | |
hashlib.sha1('{username}{password}{value_from_above}'.encode('utf-8')).hexdigest() |