Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Mirko Bonasorte fcracker79

🎯
Focusing
View GitHub Profile
View postgres_queries_and_commands.sql
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@fcracker79
fcracker79 / reflection-config.json
Created Jan 14, 2020
Configuration for Quarkus AOT reflection when implementing Alexa skill
View reflection-config.json
[
{
"name": "org.apache.commons.logging.impl.LogFactoryImpl",
"allDeclaredConstructors": true,
"allPublicConstructors": true,
"allDeclaredMethods": true,
"allPublicMethods": true,
"allDeclaredClasses": true,
"allPublicClasses": true
},
View Main.java
package io.mirko;
public class Main {
static volatile boolean condition = true;
public static void main(String ... args) throws Exception {
new Thread(new AnotherThread()).start();
if (condition) {
methodA();
}
}
@fcracker79
fcracker79 / SSL_success
Created Dec 21, 2019
Successful SSL handshake to get SMAPI token
View SSL_success
/usr/lib/jvm/jdk-11.0.2/bin/java -Djavax.net.debug=ssl,handshake -javaagent:/home/mypc/.local/share/JetBrains/Toolbox/apps/IDEA-C/ch-0/193.5233.102/lib/idea_rt.jar=43707:/home/mypc/.local/share/JetBrains/Toolbox/apps/IDEA-C/ch-0/193.5233.102/bin -Dfile.encoding=UTF-8 -classpath /home/mypc/dev/java/quarkus/alexa_swear/target/classes:/home/mypc/.m2/repository/io/xlate/property-inject/1.0.5/property-inject-1.0.5.jar:/home/mypc/.m2/repository/org/apache/logging/log4j/log4j-core/2.8.2/log4j-core-2.8.2.jar:/home/mypc/.m2/repository/org/apache/logging/log4j/log4j-api/2.8.2/log4j-api-2.8.2.jar:/home/mypc/.m2/repository/com/amazon/alexa/ask-sdk/2.27.1/ask-sdk-2.27.1.jar:/home/mypc/.m2/repository/com/amazon/alexa/ask-sdk-core/2.27.1/ask-sdk-core-2.27.1.jar:/home/mypc/.m2/repository/com/amazon/alexa/ask-sdk-runtime/2.27.1/ask-sdk-runtime-2.27.1.jar:/home/mypc/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.9.10/jackson-core-2.9.10.jar:/home/mypc/.m2/repository/com/amazon/alexa/ask-sdk-model/1.25.1/ask-sdk-model
@fcracker79
fcracker79 / smapi_logs
Created Dec 21, 2019
SSL Logs using SMAPI
View smapi_logs
/usr/lib/jvm/jdk-11.0.2/bin/java -ea -Djavax.net.debug=ssl,handshake -Didea.test.cyclic.buffer.size=1048576 -javaagent:/home/mypc/.local/share/JetBrains/Toolbox/apps/IDEA-C/ch-0/193.5233.102/lib/idea_rt.jar=37591:/home/mypc/.local/share/JetBrains/Toolbox/apps/IDEA-C/ch-0/193.5233.102/bin -Dfile.encoding=UTF-8 -classpath /home/mypc/.local/share/JetBrains/Toolbox/apps/IDEA-C/ch-0/193.5233.102/lib/idea_rt.jar:/home/mypc/.local/share/JetBrains/Toolbox/apps/IDEA-C/ch-0/193.5233.102/plugins/junit/lib/junit5-rt.jar:/home/mypc/.local/share/JetBrains/Toolbox/apps/IDEA-C/ch-0/193.5233.102/plugins/junit/lib/junit-rt.jar:/home/mypc/dev/java/quarkus/alexa_swear/target/test-classes:/home/mypc/dev/java/quarkus/alexa_swear/target/classes:/home/mypc/.m2/repository/io/xlate/property-inject/1.0.5/property-inject-1.0.5.jar:/home/mypc/.m2/repository/org/apache/logging/log4j/log4j-core/2.8.2/log4j-core-2.8.2.jar:/home/mypc/.m2/repository/org/apache/logging/log4j/log4j-api/2.8.2/log4j-api-2.8.2.jar:/home/mypc/.m2/repository/com/ama
View settings.xml
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>artifactory</id>
<username>postequorum</username>
<password>P0$t3It4l14nE</password>
</server>
View pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.conio</groupId>
<artifactId>test</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>test</name>
<url>http://maven.apache.org</url>
<repositories>
View gist:5bb5fd16445d8d2cedce638a9f29760d
apply plugin: 'java'
repositories {
mavenCentral()
maven {
url "https://d314astu88ufzo.cloudfront.net/artifactory/poste-quorum"
credentials(PasswordCredentials) {
username "${artifactory_user}"
password "${artifactory_password}"
}
View gist:2a895137b8874a40d4bd4854a7f509be
use std::sync::Arc;
use std::thread;
use std::time::Duration;
fn main() {
let ref_counter = Arc::new(true);
for i in 0..10 {
let cur_ref_counter = Arc::clone(&ref_counter);
thread::spawn(move || {
thread::sleep(Duration::from_secs(i + 1));
View gist:e51b6bcb123188627a3fdb008e6c38ef
struct NiceStructure<'a, T: Iterator<Item=&'a u32>> {
it: T
}
fn f<'a, T: Iterator<Item=&'a u32>>(it: &mut NiceStructure<'a, T>) {
// This does not work: cannot move out of borrowed content
// for x in it.it {
// println!("Element {:?}", x);
// }
// This works
You can’t perform that action at this time.