Skip to content

Instantly share code, notes, and snippets.

View jcubic's full-sized avatar
🎯
Focusing

Jakub T. Jankiewicz jcubic

🎯
Focusing
View GitHub Profile
@jcubic
jcubic / cdn.md
Last active May 8, 2024 15:04
How to setup a literally free CDN
@jcubic
jcubic / discount.php
Last active May 1, 2024 13:19
Calculate regional discount using Parity Purchasing Power for user IP address
<?php
// Copyright (C) Jakub T. Jankiewicz
// this code is released to Public Domain with CC0 license
// created with the help from ChatGPT
$default_country = [
'name' => 'Poland',
'code' => 'PL'
];
@jcubic
jcubic / r-shell.js
Last active April 8, 2024 00:33
JavaScript bookmark that can be used to open interactive R shell in shiny app
javascript:(function($) {
var handlers = [];
if (typeof Shiny !== 'undefined') {
Shiny.addCustomMessageHandler("__EVAL__", function(data) {
handlers.forEach(function(handler) {
handler(data);
});
});
}
var index = 0;
@jcubic
jcubic / example.js
Last active April 3, 2024 12:28
Simple S-Expression (lisp) paser in JavaScript
console.log(parse(`(define (square x)
"Function calculate square of a number"
(* x x))`)[0].toString());
// ==> (define (square x) "funkcja square wywołanie (square 10) zwraca 100" (* x x))
@jcubic
jcubic / index.html
Created December 21, 2023 16:03
CSS-in-JS that supports strict CSP - PoC
<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<meta http-equiv="Content-Security-Policy" content="script-src code.jquery.com 'nonce-2726c7f26c'; style-src 'nonce-2726c7f26c'" />
<title></title>
<meta name="Description" content=""/>
<link rel="shortcut icon" href=""/>
<!--[if IE]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
@jcubic
jcubic / mail.py
Created April 3, 2023 09:43
Script that sends spoofed emails
#!/usr/bin/env python
from smtplib import SMTP_SSL as SMTP
from email.mime.text import MIMEText
from optparse import OptionParser
from email.Utils import formatdate
import sys
if __name__ == '__main__':
@jcubic
jcubic / shell.php
Last active March 28, 2023 18:51
Simple jQuery Terminal based php shell
<?php
if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) &&
$_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest' && isset($_POST['cmd'])) {
system($_POST['cmd']);
exit();
}
?>
<!DOCTYPE html>
<html>
<head>
@jcubic
jcubic / file-explorer.html
Last active November 30, 2022 22:26
File Explorer in jQuery UI dialog with Editor
<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>File Explorer using jQuery UI</title>
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script src="http://code.jquery.com/ui/1.12.0/jquery-ui.js"></script>
<script src="jquery.filebrowser/js/jquery.filebrowser-src.js"></script>
<script src="json-rpc/json-rpc.js"></script>
@jcubic
jcubic / index.html
Last active November 19, 2022 00:11
Server-Sent Events with Service worker issue
<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
</head>
<body>
<button id="sse_start" disabled>Start</button>
<button id="sse_stop" disabled>Stop</button>
<pre id="output">Loading Service Worker</pre>
<script>
@jcubic
jcubic / compile
Last active June 28, 2022 16:36
POC for Emscripten Async code + jQuery Terminal
emcc -o main.html -s FETCH=1 -s NO_EXIT_RUNTIME=0 main.c