Skip to content

Instantly share code, notes, and snippets.

View alexd2580's full-sized avatar
💭
🇯🇵

Sascha alexd2580

💭
🇯🇵
View GitHub Profile
@alexd2580
alexd2580 / polyglot
Created September 24, 2023 17:06
Polyglot in 18 Languages
#define X[<?php ob_end_clean();echo"PHP\n";__halt_compiler();#print(("ALGOL68",newline))COMMENT]
#if 0/*++++++++++[->++++++++++<]>[->+>+>+>+<<<<]+++++[->>+>++>+++<<<<]<++++++++[->++++++++<]*/
### >++.>>>>-.<<<---.>.>.<---.>>+++.<<<++.>>---.>>++++++++++.>[ \
q="""=;BEGIN{print'Perl';exit;}"+%^ set a 1;test "0$a" -eq 1 &&echo "Fish" &&exit;let a=4;test "$a[1]" = "4" &&echo "Zsh" ||echo "Bash";exit
#""";__import__("sys").stdout.write("Python2\n" if 1/2==0 else "Python3\n");"""^;puts"Ruby";exit;%^
string cat : /*x
set b :
puts tcl; exit;
define b
@alexd2580
alexd2580 / lol
Last active September 21, 2023 15:19
Selfchained polyglot in 12 languages
#ifdef X//[<?php echo"\rExecuted with PHP\n";system("a68g ".$argv[0].";rm .Random.seed");system("ruby ".$argv[0]);__halt_compiler();]#COMMENT
#++++++++++[->+>+++>+++++++>+++++++>++++++++>++++++++++>++++++++++++<<<<<<<]>
#>>-.>>>>.<+.--.>---.-.<++.-.<<<<++.>>>>>+++.<+++++.>---.<-.<<<<.>---.>>++.<<-.>+++.>----.<---.>+++++++.<<++.>+++++.<<<.<[
q="";""":";q=+1;q=%^;#=;q@
echo "Executed with BASH";cp "$0" "$0.lhs";runghc --ghc-arg=-cpp --ghc-arg=-pgmP --ghc-arg="python $0" "$0.lhs";rm "$0.lhs";exit 0
@;print"Executed with PERL\n";system("cp $0 $0.f90;gfortran -cpp $0.f90 -o f90 2>-;./f90;rm f90 $0.f90");q@"""
import sys,os;s=sys.argv
if len(s)<2:print("Executed with PYTHON",flush=True);os.system('cp {a} {a}.c;g++ -trigraphs {a}.c -o cpp 2>-;./cpp;rm cpp {a}.c'.format(a=s[0]));sys.exit(0)
with open(next(b for(a,b)in zip(s,s[1:])if a[0]!='-'and b[0]!='-'))as i,open(next(b for(a,b)in zip(s,s[1:])if a=='-o'),"a")as o:
[o.write(l)for l in i if l[0]!='#']
@alexd2580
alexd2580 / .pre-commit-config.yaml
Last active June 13, 2021 13:43
Python flake8/isort/black/mypy pre-commit config
repos:
- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.4
hooks:
- id: flake8
exclude: migrations|snippets
additional_dependencies: [flake8-isort, flake8-black]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.800
hooks: