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
// Compile node module first `https://github.com/boriborm/cryptopro-node-cades` | |
const fs = require("node:fs"); | |
const cades = require("./NodeCades"); | |
const signedData = new cades.SignedData(); | |
const message = fs.readFileSync("message.txt", { encoding: "utf-8" }); | |
signedData.content = message; // string | |
const signatureRaw = fs.readFileSync("message.txt.sig"); // buffer |
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
<!DOCTYPE html> | |
<html lang="ru"> | |
<head> | |
<meta charset="utf-8" /> | |
<title>Проверки подписи</title> | |
<script language="javascript" src="cadesplugin_api.js"></script> | |
<script> | |
const { cadesplugin } = window; | |
class Certificate { |
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 pycades | |
signed_data = pycades.SignedData() | |
with open('message.txt') as f: | |
msg = f.read() | |
signed_data.Content = msg | |
with open('message.txt.sig') as f: | |
signature_raw = f.read() |
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
# Given an unsorted array, leftSum is defined as sum of all elements to the left of an element including the element | |
# and rightSum is defined as sum of all elements to the right of an element. | |
# | |
# Write a function that returns the minimum absolute difference between leftSum and rightSum. | |
# | |
# Example: | |
# | |
# Input: arr = [3,1,2,4,3] | |
# Output: 1 | |
# Explanation: |
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 time | |
import boto3 | |
sns_client = boto3.client("sns", region_name='eu-central-1') | |
sqs_client = boto3.client("sqs", region_name="eu-central-1") | |
sns_client.publish( | |
TopicArn='arn:aws:sns:eu-central-1:386635533411:enveloped', | |
Message='test message', | |
MessageAttributes={ |
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
package main | |
import "fmt" | |
func main() { | |
fmt.Printf("hello, world\n") | |
} |
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/env python | |
import fileinput | |
import re | |
import binascii | |
for line in fileinput.input(inplace = 1): | |
if re.search('X\'([a-fA-F0-9]+)\'', line) is not None: | |
unhexed_string = binascii.unhexlify(re.search('X\'([a-fA-F0-9]+)\'', line).group(1)) | |
unhexed_string = unhexed_string.replace("'", "''") |
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
$ # compress a file and encode it in base64 format | |
$ gzip -k -c grafana.db | base64 - > grafana.db.gz.base64 | |
$ # calculate md5 sum | |
$ md5sum grafana.db.gz.base64 | |
$ # calculate md5 sum and compare results | |
$ md5sum grafana.db.gz.base64 | |
$ # to decompress, reverse actions | |
$ base64 -D grafana.db.gz.base64 | gunzip > grafana.db |
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
# -*- coding: utf-8 -*- | |
from __future__ import unicode_literals | |
import shutil | |
import sys | |
from urlparse import urljoin | |
import requests | |
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
widget = widget or self.widget | |
if isinstance(widget, type): | |
widget = widget() |