Skip to content

Instantly share code, notes, and snippets.

Jakub T. Jankiewicz jcubic

Block or report user

Report or block jcubic

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jcubic
jcubic / module.js
Last active Sep 3, 2018
Module definition function with namespace and dependencies
View module.js
// -----------------------------------------------------------------------------
// Copyright (c) 2018 Jakub Jankiewicz
// Released under MIT license
//
// generic namespace generator the constructor should declare private functions
// and variables and return public api, the module is created when all dependecies
// are resolved (all modules are created)
//
// @param namespace dot separated namespace that will be added to window object
// @param dependencies array of string (dependencies) can be empty array
@jcubic
jcubic / cert
Last active Mar 10, 2018
Upload SSL Certificate to DirectAdmin controlled domains
View cert
#!/bin/bash
output=$(mktemp);
sudo certbot certonly --manual --expand --manual-public-ip-logging-ok \
--preferred-challenges http -n \
-d <LIST OF COMMA SEPARATED DOMAINS AND SUBDOMAINS>\
--manual-auth-hook ./cert.py --agree-tos --email <EMAIL ADRESS> 2>&1 | tee $output
grep "Certificate not yet due for renewal" $output > /dev/null || \
@jcubic
jcubic / server.py
Created Feb 4, 2018
Simple HTTP server for static files
View server.py
#!/usr/bin/python
import socket
import re
import os
import threading
header_re = re.compile(r"(GET|POST) ([^ ]+) HTTP/", re.I)
def status(code):
@jcubic
jcubic / css.js
Created Jan 24, 2018
Monkey patch for jQuery css to handle custom properties aka css variables
View css.js
$.fn.css = (function(css) {
return function fn(key, value) {
var self = this;
if (arguments.length == 1 && $.isPlainObject(arguments[0])) {
var data = arguments[0];
Object.keys(data).forEach(function(key) {
fn.call(self, key, data[key]);
});
} else if (key.match(/^\s*--/)) {
if (typeof value === 'undefined') {
@jcubic
jcubic / compile
Last active Jun 18, 2019
POC for Emscripten Async code + jQuery Terminal
View compile
emcc -o main.html -s FETCH=1 -s NO_EXIT_RUNTIME=0 main.c
@jcubic
jcubic / .htaccess
Last active Dec 22, 2017
Simple url shortener in php and sqlite
View .htaccess
RewriteEngine on
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule (.*) /index.php?$1
@jcubic
jcubic / shell.php
Created Dec 18, 2017
Simple jQuery Terminal based php shell
View shell.php
<?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 / git_sqllite.py
Created Oct 22, 2017
Create sqlite data base from git repo commits
View git_sqllite.py
#!/usr/bin/env python
import git
import json
import sqlite3
import re
import os
import os.path
def log(repo):
@jcubic
jcubic / file-explorer.html
Last active Oct 4, 2019
File Explorer in jQuery UI dialog with Editor
View file-explorer.html
<!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 / ReflectService.java
Last active Aug 9, 2017
ReflectService plugin
View ReflectService.java
package com.example.package;
import android.content.Context;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StringWriter;
import java.io.PrintWriter;
You can’t perform that action at this time.