Skip to content

Instantly share code, notes, and snippets.

View slav123's full-sized avatar

Slawomir Jasinski slav123

View GitHub Profile
@slav123
slav123 / MY_Upload.php
Created September 23, 2021 08:28
Extended / Overloaded CI-Upload Class to handle Flash-Form-Uploaded Images via Application/octet-stream
<?php
/**
* Extended / Overloaded CI-Upload Class to handle Flash-Form-Uploaded Images via Application/octet-stream
*
*/
if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
* Extends the CodeIgniter Upload-Class
*/
@slav123
slav123 / post.php
Last active May 20, 2023 20:21
PHP CURL POST query multipart/form-data
<?php
curl_setopt_array($curl, array(
CURLOPT_URL => "API_ENDPOINT",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
@slav123
slav123 / autosave.js
Created September 8, 2021 14:08
simple javascript autosave
var timeoutId;
$(document).on('keypress', '#overview', function () {
if (timeoutId) clearTimeout(timeoutId);
let brief = $(this).val()
let steps_id = $(this).data('id')
timeoutId = setTimeout(function () {
$.ajax({
package main
import (
exif "github.com/dsoprea/go-exif/v3"
exifcommon "github.com/dsoprea/go-exif/v3/common"
jpeg "github.com/dsoprea/go-jpeg-image-structure/v2"
)
func setExifTag(rootIB *exif.IfdBuilder, ifdPath, tagName, tagValue string) error {
@slav123
slav123 / Dockerfile
Created July 14, 2021 07:20
full docker file with working CGO bindings and option to update debian image
FROM golang:latest AS base
RUN apt-get update && \
apt-get -y --no-install-recommends install software-properties-common && \
add-apt-repository "deb http://httpredir.debian.org/debian bullseye main" && \
apt-get update && \
apt-get -qq install -y libvips-dev && rm -rf /var/lib/apt/lists/*
WORKDIR /app
@slav123
slav123 / pm.js
Created July 13, 2021 09:37
datatables defs
"columnDefs": [
{"className": 'nowrap', 'targets': [0, 1, 4]},
{"className": 'text-right', 'targets': [10, 11, 13, 14, 15, 16, 21, 23]},
// {"render": $.fn.dataTable.render.moment( 'Do MMM YYYY' , 'YYYY-MM-DD' ), 'targets' : [8]}
],
@slav123
slav123 / bench.sh
Created May 11, 2021 06:55
benchmark vips
#!/bin/sh
START_TIME=$(date +%s)
vipsthumbnail 2300.jpg --size 800
END_TIME=$(date +%s)
echo "It took $(($END_TIME - $START_TIME)) seconds to sleep of 1 second..."
@slav123
slav123 / gist:61fdbac39f92f66b04ef735da8198f22
Created April 21, 2021 11:20
xpath selector with class
//div[contains(concat(' ',normalize-space(@class),' '),'card hover-effect')]
docker run --platform linux/arm64
--
Alteos GmbH | Tauentzienstraße 7 b/c | 10789 Berlin | Deutschland
Geschäftsführer: Dr. Sebastian Sieglerschmidt | Vorsitzender des Beirats:
Dr. Nils Reich | Sitz der Gesellschaft: Berlin | Registergericht:
@slav123
slav123 / kill-all-php-fpm.sh
Last active April 14, 2021 09:12 — forked from bmichalski/kill-all-php-fpm.sh
Kill all php-fpm processes
sudo kill -9 `sudo ps -ef | grep php-fpm | grep -v grep | awk '{print $2}'`
ps -A | grep php-fpm | awk '{print $1}' | xargs kill -9 $1