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 os | |
from datetime import datetime | |
def sync_timestamps(backup_folder, destination_folder, dry_run=False): | |
# Loop through the files in the destination folder | |
for file_name in os.listdir(destination_folder): | |
destination_file_path = os.path.join(destination_folder, file_name) | |
destination_modified_time = os.path.getmtime(destination_file_path) | |
# Check if there is a corresponding file in the backup folder with the same name |
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
---------------------------- MODULE KafkaRoller ---------------------------- | |
EXTENDS Integers, Sequences, FiniteSets | |
CONSTANTS | |
ControllerNodes, \* Set of nodes with the controller role | |
BrokerNodes, \* Set of nodes with the broker role | |
CombinedNodes, \* Set of nodes with both controller and broker roles | |
MaxRestartAttempts, \* Maximum number of restart attempts allowed per node | |
MaxRetries \* Maximum number of retries allowed per node |
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 decode(msg): | |
text = [] | |
for i in range(0, len(msg), 2): | |
text.append(unrot(msg[i: i + 2])) | |
return str.join('', text) | |
def unrot(pair, key=ord('x')): | |
offset = 0 | |
for c in 'cdefgh': |
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/env python | |
"""Convert CSV policies into AWS JSON format.""" | |
import json | |
import csv | |
POLICIES = 'terraform.csv' | |
CRUD_COL = 2 | |
ACTION_COL = 3 |
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
#!/bin/sh | |
# It seems it's very hard to set resample output quality with Ghostscript. | |
# So instead rely on `prepress` preset parameter to select a good /QFactor | |
# and override the options we don't want from there. | |
gs \ | |
-o resampled.pdf \ | |
-sDEVICE=pdfwrite \ | |
-dPDFSETTINGS=/prepress \ |
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 gevent | |
import gevent.server | |
import gevent.monkey | |
gevent.monkey.patch_all() | |
import socket | |
import string | |
import random | |
import filecmp |
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
// avcodec_sample.0.5.0.c | |
// Original source: | |
// http://web.me.com/dhoerl/Home/Tech_Blog/Entries/2009/1/22_Revised_avcodec_sample.c.html | |
// | |
// A small sample program that shows how to use libavformat and libavcodec to | |
// read video from a file. | |
// | |
// This version is for the 0.4.9+ release of ffmpeg. This release adds the | |
// av_read_frame() API call, which simplifies the reading of video frames |
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
from PIL import Image | |
from io import BytesIO | |
import itertools | |
def as_pbm(w, h, data): # -> bytes | |
ret = bytes() | |
ret += b'P4\n' | |
ret += (str(w) + ' ' + str(h) + '\n').encode('ascii') |
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
{ | |
"type": "object", | |
"required": [ | |
"AWSEBDockerrunVersion", | |
"containerDefinitions", | |
"volumes" | |
], | |
"properties": { | |
"AWSEBDockerrunVersion": { | |
"type": "integer", |
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
resource "aws_iam_policy" "terraform_create_policy" { | |
name = "terraform_create_policy" | |
path = "/" | |
policy = "${data.aws_iam_policy_document.terraform_create_policy.json}" | |
} | |
data "aws_iam_policy_document" "terraform_create_policy" { | |
statement { | |
sid = "1" | |
actions = [ |
NewerOlder