Skip to content

Instantly share code, notes, and snippets.

View cataphract's full-sized avatar

Gustavo Lopes cataphract

View GitHub Profile
@Grab('io.undertow:undertow-core:2.2.25.Final')
@Grab('io.undertow:undertow-servlet:2.2.25.Final')
@Grab('com.squareup.okhttp3:okhttp:4.9.1')
import io.undertow.Undertow
import io.undertow.channels.DetachableStreamSinkChannel
import io.undertow.server.HttpServerExchange
import io.undertow.servlet.Servlets
import io.undertow.servlet.api.DeploymentInfo
import io.undertow.servlet.api.ServletContainer
function _h {
local postprompt=$1
local prompt
if [[ $# -eq 1 || $2 == '-' ]]; then
prompt=$(cat)
else
prompt="$2"
fi
prompt=$(echo "$prompt"$'\n'"$postprompt" | jq -sR '@text')
@cataphract
cataphract / cmdline
Last active March 27, 2023 14:37
C++ with no standard lib
g++ -v -std=c++11 -fno-exceptions -fno-rtti -nostdlib \
/usr/lib/x86_64-linux-gnu/{Scrt1.o,crti.o} \
/usr/lib/gcc/x86_64-linux-gnu/11/crtbeginS.o \
example.cpp -o example \
-lgcc \
-Wl,--push-state -Wl,--as-needed -lgcc_s -Wl,--pop-state \
-lc -lgcc \
-Wl,--push-state -Wl,--as-needed -lgcc_s -Wl,--pop-state \
/usr/lib/gcc/x86_64-linux-gnu/11/crtendS.o \
/usr/lib/x86_64-linux-gnu/crtn.o
struct link_map {
char _other[8];
char *l_name;
char _other2[776];
unsigned l_direct_opencount;
};
uprobe:/usr/lib/x86_64-linux-gnu/libc.so.6:dlopen {
@enter[tid] = arg0;
}
uretprobe:/usr/lib/x86_64-linux-gnu/libc.so.6:dlopen {
struct link_map {
char _other[8];
char *l_name;
};
uprobe:/usr/lib/x86_64-linux-gnu/libc.so.6:dlopen {
printf("opening %s\n", str(reg("di")));
}
uprobe:/usr/lib/x86_64-linux-gnu/libc.so.6:dlclose {
$lm = (struct link_map*)reg("di");
printf("closing %s\n", str($lm->l_name));
import org.springframework.batch.core.*
@Grab('org.springframework.batch:spring-batch-core:3.0.6.RELEASE')
import org.springframework.batch.core.configuration.annotation.*
import org.springframework.batch.core.job.builder.FlowBuilder
import org.springframework.batch.core.job.flow.Flow
import org.springframework.batch.core.launch.JobLauncher
import org.springframework.batch.core.listener.ExecutionContextPromotionListener
import org.springframework.batch.core.partition.support.Partitioner
import org.springframework.batch.core.scope.context.ChunkContext
import org.springframework.batch.core.scope.context.StepSynchronizationManager
import groovy.transform.CompileStatic
import java.lang.invoke.*
import static groovyjarjarasm.asm.Opcodes.H_INVOKESTATIC
class Logger {
private final String name
Logger(Class cls) {
name = cls.name
#include <iostream>
#include <type_traits>
struct type_to_convert {
type_to_convert(int i) : i(i) {};
type_to_convert(const type_to_convert&) = delete;
type_to_convert(type_to_convert&&) = delete;
int i;
};
\set ON_ERROR_STOP on
-- The strategy for permissions will be:
-- – Assign all permissions to the owner.
-- – If a table owner does not match the schema name, assign all permissions
-- the role with the same name as the schema.
-- – Assign all permissions on all objects to tm_cz, which even needs to
-- drop and create tables in some cases.
-- — Assign read/usage permissions on all tables, views, sequences and
-- functions to biomart_user on all non-ETL schemas.
-- – Assign insert,delete,update permissions on all tables on searchapp.
@cataphract
cataphract / Dockerfile
Last active December 6, 2019 14:56
PHP bug #78919
FROM php:7.2.25
ADD config.m4 php_rinit_error.h rinit_error.c /opt/rinit_error/
RUN cd /opt/rinit_error && phpize && ./configure && make -j install && make clean
ADD index.php /var/www/html
CMD ["php", "-S", "0.0.0.0:8080", "-d", "memory_limit=2m", \
"-d", "extension=rinit_error.so", "index.php"]