Skip to content

Instantly share code, notes, and snippets.

View p4535992's full-sized avatar
🙄
I may be slow to respond.

4535992 p4535992

🙄
I may be slow to respond.
View GitHub Profile
@code-boxx
code-boxx / 0-JS-SORTABLE-TABLE.MD
Last active September 18, 2023 11:04
Javascript Sortable Table
@joulgs
joulgs / terminal.txt
Last active June 27, 2024 05:09
How install libssl1.1 on ubuntu 22.04
wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.0g-2ubuntu4_amd64.deb
sudo dpkg -i libssl1.1_1.1.0g-2ubuntu4_amd64.deb
// FROM Jenthura ( https://github.com/jenthura/foundryVTT5eConditionRulesMacro/blob/master/ConditionRulesMacro.js )
function postToChat(conditionName, imgURL, message){
let chatData = {
user: game.user._id,
speaker: {alias: "Conditions"},
content: `<div class="dnd5e chat-card" style="text-align: center"><header class="card-header flexrow"><h3 class="item-name">${conditionName}</h3></div><br><div style="text-align: center"><img width=75% height=50% src="${imgURL}"</img></div><br>${message}`
};
ChatMessage.create(chatData, {});
};
var assocname = '<thumbnailname>';
var node = document.childAssocs['rn:rendition'].filter(function(assoc){
return assoc.name == assocname;
})[0];
if(node){
logger.log(node.remove());
}
@Aarowaim
Aarowaim / foundryvtt-token-vision.js
Last active May 18, 2020 05:35
A macro for the Foundry virtual tabletop that lets a user configure their token's vision and lighting setting. Has a dependency on About Time by Tim Posney.
if (canvas.tokens.controlled.length === 0)
ui.notifications.error("Please select a token");
if (game.modules.get("about-time").active != true)
ui.notifications.error("About Time isn't loaded");
let namedfields = (...fields) => {
return (...arr) => {
var obj = {};
fields.forEach((field, index) => {
@tyb
tyb / print_map.java
Created July 22, 2019 09:47
Pretty-print a Map in Java
//as json
new Gson().toJson(map)
//as json
ObjectMapper mapper = new ObjectMapper();
mapper.writerWithDefaultPrettyPrinter().writeValueAsString(object);
//as json
Map<String, Object> stats = ...;
System.out.println(new JSONObject(stats).toString(2));
@Heilum
Heilum / Test.java
Last active June 2, 2023 09:51
Apache Tika + Tesseract-OCR to scan Chinese text in pdf
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Paths;
@Glamdring
Glamdring / TimestampValidationService.java
Created December 17, 2017 08:39
Validating trusted timestamps
public class TimestampValidationService {
public boolean validate(String hash, String encodedTimestampToken) {
try {
byte[] tokenBytes = Base64.getDecoder().decode(encodedTimestampToken);
CMSSignedData signedData = new CMSSignedData(tokenBytes);
TimeStampToken token = new TimeStampToken(signedData);
Optional<X509CertificateHolder> certHolder = getCertificateHolder(signedData);
BcRSASignerInfoVerifierBuilder verifierBuilder = new BcRSASignerInfoVerifierBuilder(
new DefaultCMSSignatureAlgorithmNameGenerator(),
@Glamdring
Glamdring / TimestampingService.java
Last active March 26, 2019 08:20
Using trusted timestamps
public class TimestampService {
private static final Logger logger = LoggerFactory.getLogger(TimestampService.class);
private static final AlgorithmIdentifier sha512oid = getSha512Oid();
private static final ASN1ObjectIdentifier baseTsaPolicyId = new ASN1ObjectIdentifier("0.4.0.2023.1.1");
private SecureRandom random = new SecureRandom();
private static AlgorithmIdentifier getSha512Oid() {
DigestAlgorithmIdentifierFinder algorithmFinder = new DefaultDigestAlgorithmIdentifierFinder();
@douglascrp
douglascrp / Alfresco SDK 3.0 with minificatio of javascript files.xml
Last active October 4, 2018 13:06
How to add the missing minification of javascript files in Alfresco SDK 3.0
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>yuicompressor-maven-plugin</artifactId>
<version>1.5.1</version>
<executions>
<execution>
<id>compress-assembly</id>
<goals>
<goal>compress</goal>
</goals>