Skip to content

Instantly share code, notes, and snippets.

View spinsch's full-sized avatar
🐱

Marc spinsch

🐱
  • HKW
  • Switzerland
  • 00:39 (UTC +02:00)
View GitHub Profile
@spinsch
spinsch / mozjpeg.sh
Last active October 16, 2020 13:40
optimize images with mozjpeg recursively
#!/bin/bash
#
# usage: bash mozjpeg.sh directory
#
find "$1" -type f -name '*.jpg' -print0 | while read -d $'\0' file
do
echo ${file}
mkdir -p opt/"$(dirname "$file")"
djpeg $file | cjpeg -quality 80 | jpegtran -optimize -progressive > opt/$file
done
@spinsch
spinsch / test
Last active September 26, 2019 15:19
Test
▕▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▏
▕ TEST ▕
▕▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▏
@spinsch
spinsch / test.php
Created January 30, 2019 09:04
test script to find the correct method
<?php
$data = "123456";
$key = "17839778773fadde0066e4578710928988398877bb123789";
$options = 0;
$key = pack("H*", $key);
foreach (openssl_get_cipher_methods() as $method)
{
$enc = @openssl_encrypt($data, $method, $key, $options);
@spinsch
spinsch / example.php
Last active January 24, 2019 16:02
get last 20 elements from sitemap.xml with php
<?php
// this is for schema http://www.sitemaps.org/schemas/sitemap/0.9
// config
$lastNElements = 20;
// url or filepath
//$source = 'https://www.digitec.ch/sitemap0.xml';
@spinsch
spinsch / clean-up-boot-partition-ubuntu.md
Created January 4, 2019 14:54 — forked from ipbastola/clean-up-boot-partition-ubuntu.md
Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Reference

Case I: if /boot is not 100% full and apt is working

1. Check the current kernel version

$ uname -r 
@spinsch
spinsch / debug.php
Created October 5, 2018 14:15
Create Test-Order on Magento 1.9.3.x with SOAP Api V2
<?php
// debug script
// apiDoc: https://devdocs.magento.com/guides/m1x/api/soap/checkout/checkout.html
$proxy = new SoapClient('http://lts.localhost/api/v2_soap/?wsdl');
$sessionId = $proxy->login('debug', 'debug123');
// create cart
@spinsch
spinsch / tld.php
Created November 22, 2017 14:35
create a tld list for copy&paste as php array
<?php
header("Content-type: text/plain");
echo "array(\n";
foreach (new NoRewindIterator(new SplFileObject('https://data.iana.org/TLD/tlds-alpha-by-domain.txt')) as $i => $v) {
if ($i == 0) {continue;};
echo "\040\040\040\040'".idn_to_utf8(trim(strtolower($v)))."',\n";
}
echo ");";
@spinsch
spinsch / netflix.txt
Created October 21, 2017 13:08
Netlix Genre List and Codes
https://www.netflix.com/browse/genre/<GENRE-CODE>/
Action & Adventure (1365)
Asian Action Movies (77232)
Classic Action & Adventure (46576)
Action Comedies (43040)
Action Thrillers (43048)
Adventures (7442)
Comic Book and Superhero Movies (10118)
Westerns (7700)
@spinsch
spinsch / fileupload_debug.php
Created August 15, 2017 14:57
image upload test for php via post
<?php
function return_bytes($val) {
$val = trim($val);
$last = strtolower($val[strlen($val)-1]);
switch($last) {
// The 'G' modifier is available since PHP 5.1.0
case 'g':
$val *= 1024;
case 'm':
@spinsch
spinsch / convert.php
Last active December 13, 2017 17:27
convert magento translation-file to apple-ios string-file to use the google translation toolkit
<?php
/**
* convert magento translation file to ios STRING file
* to use the google translation toolkit
*
* usage: php convert.php translation.csv > translation.STRINGS
* php convert.php translation.STRINGS > translation.csv
*
* @author rcro <romano.marc@gmail.com>
*/