This file contains hidden or 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
const fs = require('fs'); | |
const path = require('path'); | |
const yaml = require('js-yaml'); | |
// Paths to files | |
const versionTagPath = path.join(__dirname, 'version-tag'); | |
const packageJsonPath = path.join(__dirname, 'package.json'); | |
const devYamlPath = path.join(__dirname, 'html/environments/dev.yaml'); | |
// Read version from version-tag file |
This file contains hidden or 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
const fs = require('fs'); | |
const path = require('path'); | |
// Read version from version-tag file | |
const versionTagPath = path.join(__dirname, 'version-tag'); | |
const packageJsonPath = path.join(__dirname, 'package.json'); | |
const version = fs.readFileSync(versionTagPath, 'utf-8').trim(); | |
if (!version) { |
This file contains hidden or 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 | |
import psycopg2 | |
import requests | |
from exchangelib import Credentials, Account, Message, DELEGATE, HTMLBody | |
from email.mime.application import MIMEApplication | |
# PostgreSQL Database Configuration | |
DB_CONFIG = { | |
"dbname": "your_database", | |
"user": "your_db_user", |
This file contains hidden or 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 | |
import psycopg2 | |
from datetime import datetime | |
from exchangelib import Credentials, Account, DELEGATE | |
# Outlook Configuration | |
OUTLOOK_EMAIL = "[email protected]" # Your technical user email | |
OUTLOOK_PASSWORD = "your_password" # Your password | |
SHARED_MAILBOX = "[email protected]" # The shared mailbox | |
FOLDER_NAME = "Inbox" # Folder to check emails from |
This file contains hidden or 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
// SPDX-License-Identifier: GPL-3.0 | |
pragma solidity >=0.8.2 <0.9.0; | |
import "hardhat/console.sol"; | |
contract LuckyChainSimple { | |
address public manager; | |
uint public level = 1; | |
uint public totalSeats = 0; |
This file contains hidden or 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
@Select({"<script>", | |
SELECT_PRODUCTS, | |
"WHERE desp_product.oid IN", | |
"<foreach item='oidItem' index='index' collection='oids'", | |
"open='(' separator=',' close=')'>", | |
"#{oidItem}", | |
"</foreach>", | |
"</script>"}) | |
@ResultMap("noParrent") | |
public List<DespProduct> getAllProductsIn(@Param("oids") List<Integer> oids) ; |
This file contains hidden or 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
PublicClientApplication app = PublicClientApplication.builder("YOUR_CLIENT_ID") | |
.authority("https://login.microsoftonline.com/YOUR_TENANT_ID") | |
.build(); | |
RefreshTokenParameters parameters = RefreshTokenParameters.builder( | |
Collections.singleton("YOUR_SCOPE"), | |
"YOUR_REFRESH_TOKEN") | |
.build(); | |
Future<IAuthenticationResult> future = app.acquireToken(parameters); |
This file contains hidden or 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
POST http://yourserver.com/your-endpoint | |
Content-Type: multipart/form-data; boundary=boundarystring | |
--boundarystring | |
Content-Disposition: form-data; name="file"; filename="sample.txt" | |
Content-Type: text/plain | |
< ./path-to-your-file/sample.txt | |
--boundarystring-- |
This file contains hidden or 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
try (OutputStream os = enc.getDataStream(fs)) { | |
os.write(inputExcel); | |
} | |
// Convert the POIFSFileSystem to a byte array | |
try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) { | |
fs.writeFilesystem(baos); | |
return baos.toByteArray(); | |
} |
This file contains hidden or 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
public static byte[] passwordProtectExcel(byte[] inputExcel) throws IOException, GeneralSecurityException { | |
// Convert the input byte array to a Workbook | |
XSSFWorkbook workbook = new XSSFWorkbook(new ByteArrayInputStream(inputExcel)); | |
// Prepare to encrypt the workbook | |
POIFSFileSystem fs = new POIFSFileSystem(); | |
EncryptionInfo info = new EncryptionInfo(EncryptionMode.agile); | |
Encryptor enc = info.getEncryptor(); | |
enc.confirmPassword("password"); // Set the password here |
NewerOlder