Skip to content

Instantly share code, notes, and snippets.

import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.util.TraceClassVisitor;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.io.Writer;
import static org.objectweb.asm.Opcodes.ASM9;
@destan
destan / Quine.java
Last active December 8, 2020 08:02
Simple Java quine, self replicating (self copying) Java code, with text blocks. This code can be run with Java 15+ or Java 13+ with special flags. License is public domain, no rights reserved.
public class Quine {
public static void main(String[] args) {
String textBlockQuotes = new String(new char[]{'"', '"', '"'});
char newLine = 10;
String source = """
public class Quine {
public static void main(String[] args) {
String textBlockQuotes = new String(new char[]{'"', '"', '"'});
char newLine = 10;
String source = %s;
@destan
destan / SpringSecurity.ascii
Last active May 15, 2022 01:35
Spring Security cheetsheet
https://gist.asciidoctor.org/?7454349eb96c97529f82b23988094af4[View this document rendered]
## SecurityContextHolder
* Holds the details of the authentication (authenticated user)
* By default the SecurityContextHolder uses a ThreadLocal to store these details
** SecurityContextHolder.MODE_THREADLOCAL `default`
** SecurityContextHolder.MODE_INHERITABLETHREADLOCAL
** SecurityContextHolder.MODE_GLOBAL
@destan
destan / cryptselection.py
Last active October 4, 2019 11:54
encrypt selection selected text cryptselection extension for zim
# -*- coding: utf-8 -*-
# cryptselection plugin for zim
#
# Copyright 2015 Klaus Holler <[email protected]>
# License: same as zim (gpl)
#
# Installation/Usage:
# * Put the cryptselection/ directory to your ~/.local/share/zim/plugins subdirectory
# i.e. cd ~/.local/share/zim/plugins &&
# git clone https://github.com/k3ho/zim-plugin-cryptselection.git cryptselection
@destan
destan / index.html
Last active October 4, 2019 11:55
Spotivote player UI
<main>
<header>
<img src="https://cdn3.iconfinder.com/data/icons/google-material-design-icons/48/ic_equalizer_48px-128.png" width=80 height=80>
<h1>
<span class="track-name">Anyone Who Knows What Love Is (Will Understand)</span>
<span class="artists-album">
<span class="artist">Irma Thomas</span>
<span class="artists-album-separator">•</span>
<span class="album">Straight From The Soul</span>
</span>
@destan
destan / dumpVersions.js
Last active February 17, 2017 11:32
Dump available library versions in Jira using OSGi Browser https://developer.atlassian.com/docs/developer-tools/using-the-osgi-browser
// on /plugins/servlet/upm/osgi page execute following and wait for all requests to complete
jQuery('h4').each( (i, e) => e.click() )
// then dump versions
let results = {}
jQuery('.upm-plugin-row h4').each(function() {
let name = jQuery(this).text()
let version = jQuery(this)
.closest('.upm-plugin.expandable')
@destan
destan / BilisimTerimleri.md
Last active October 4, 2019 12:13
bilisim terimleri, bilişim terimleri sözlüğü
Yabancı Sözcük Öneri
Tutorial Eğitsel
Cross-cutting concern Kesişen kaygı
@destan
destan / ParseRSAKeys.java
Last active October 28, 2024 07:07
Parse RSA public and private key pair from string in Java
import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.security.KeyFactory;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
import java.security.interfaces.RSAPublicKey;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.PKCS8EncodedKeySpec;