Skip to content

Instantly share code, notes, and snippets.

View Flower7C3's full-sized avatar
🪲
99 little bugs in the code, take one down, patch it around, 117 little bugs…

Bartłomiej Jakub Kwiatek Flower7C3

🪲
99 little bugs in the code, take one down, patch it around, 117 little bugs…
View GitHub Profile
@Flower7C3
Flower7C3 / Makefile
Created January 1, 2024 23:31
mmpk.info edytor połączeń
POLICY_FILE = "${HOME}/Applications/mmpk/java.policy"
SPLASH_FILE = "${HOME}/Applications/mmpk/logo5.png"
JNLP_FILE = "${HOME}/Applications/mmpk/edytor_polaczen_mmpk.jnlp"
APP_NAME = "Edytor-połączeń-mMPK.info"
install:
@printf "Prepare JAVA policy file "
@echo '' > ${POLICY_FILE}
@echo 'grant {' >> ${POLICY_FILE}
@echo ' permission java.awt.AWTPermission "accessClipboard";' >> ${POLICY_FILE}
@echo ' permission java.security.AllPermission;' >> ${POLICY_FILE}
<?php
if (is_file(__DIR__ . '/sites/sites.php')) {
$sites = [];
include __DIR__ . '/sites/sites.php';
$domains = [];
foreach ($sites as $host => $locale) {
$environment = preg_match('(site\.pride\.gl)', $host) ? 'stage' : 'prod';
[$language, $country] = explode('_', $locale);
$domains[$country][$language][$environment] = $host;
@Flower7C3
Flower7C3 / plantuml-build.sh
Created March 4, 2020 13:54
Build plantuml from file with plantuml.jar
#!/usr/bin/env bash
cd $(dirname $0)
files="$@"
if [[ -z "$files" ]]; then
files="$(ls *.puml)"
fi
java -jar plantuml.jar -v -tpng $files
exit
@Flower7C3
Flower7C3 / rebuild-prestashop-child-theme-translations.sh
Last active January 6, 2023 20:35
Rebuild PrestaShop translations in child theme
PHP_PATh="/opt/php-7.1/bin/php"
APP_ROOT_DIR="/web/"
MAIN_LANG="pl-PL"
with_dry_run="y"
themes_dir_name="themes/"
translations_dir_name='translations/'
template_file_name='templates/example.tpl'
@Flower7C3
Flower7C3 / hexadecimal.php
Last active August 28, 2019 18:24
Pronounce HEX value
<?php
class HexTools
{
private static $verbalMap = [
'00' => 'zero',
'-0' => '',
'0-' => '',
'-1' => 'one',
'1-' => 'teen',
@Flower7C3
Flower7C3 / script-bookmark.js
Created March 19, 2019 08:21
Add some vulgarity to page #fun
javascript:{var%20whitespace%20=%20"-\/|.,!:;'\"%20\t\n\r{}[]()";var%20stack%20=%20[];var%20curNIndex%20=%200;var%20curNode%20=%20null;var%20curIndex%20=%20-1;var%20state%20=%201;var%20lastword%20=%20'';String.prototype.startsWith%20=%20function(prefix)%20{return%20this.indexOf(prefix)%20===%200;};String.prototype.endsWith%20=%20function(suffix)%20{return%20this.match(suffix+"$")%20==%20suffix;};/*%20Nie%20moge%20tak%20robi%C4%87%20niestety%20*/function%20kurwizeLink(url){if(url.startsWith('javascript:'))return%20url;%20/*%20chyba%20niewiele%20moge%20zrobic%20kurwa%20*/if(url.startsWith('#'))return%20url;if(url.startsWith('https://www.google.pl'))return%20url;%20/*%20no,%20bo%20kurwa,%20bez%20jaj%20;p%20*/var%20base%20=%20'';if(!url.startsWith('http')){base%20=%20location.protocol%20+%20"://"%20+%20location.host;if(!url.startsWith('/')){var%20pathname%20=%20location.pathname;base%20+=%20pathname.substring(0,%20pathname.lastIndexOf('/'));}}return%20'http://kurwa.keraj.net/?url='+base+url;};function%20nextLette
@Flower7C3
Flower7C3 / facebook-calendar.php
Created March 18, 2019 09:59
Facebook calendar parser (add wordwrap after 75 characters in line)
<?php
error_reporting(0);
ini_set('display_errors', false);
# VALIDATION
if (!isset($_GET['uid'], $_GET['key'], $_GET['type'])) {
http_response_code(400);
die('No request params!');
}
@Flower7C3
Flower7C3 / symfony-annotations-validate.php
Created June 26, 2018 21:45
Search errors in PHP classes annotations with Symfony ClassMapGenerator, ReflectionClass and ReflectionMethod.
<?php
use Symfony\Component\ClassLoader\ClassMapGenerator;
$loader = require_once __DIR__ . '/../app/bootstrap.php.cache';
require_once __DIR__ . '/../app/AppKernel.php';
$kernel = new AppKernel('dev', true);
$kernel->loadClassCache();
$kernel->boot();
@Flower7C3
Flower7C3 / time_hasher.php
Created September 12, 2017 08:48
Encode and decode time string in 36 base system
<?php
function generate_time($timeString='now'){
$datetime = new \DateTime($timeString);
$string = sprintf("%02d-%06d-%08d-%02d",
mt_rand(0,99),
$datetime->format('u'),
(
$datetime->format('z')*24*60*60
+ $datetime->format('H')*60*60
@Flower7C3
Flower7C3 / paktpub-claim.js
Last active April 15, 2017 05:16
Claim free book from PaktPub.com - just add min script as bookmark
var PaktPub = (function () {
"use strict";
var freeLearningURL = 'https://www.packtpub.com/packt/offers/free-learning',
logoutURL = 'https://www.packtpub.com/logout';
var notify = function (message, timeout) {
var useNotificationAPI = false;
if ("Notification" in window) {
if (Notification.permission === "granted") {
useNotificationAPI = true;
} else if (Notification.permission !== 'denied') {