Skip to content

Instantly share code, notes, and snippets.

View micronax's full-sized avatar

Fabian Golle micronax

View GitHub Profile
@superseb
superseb / cleanup.sh
Last active June 19, 2023 10:03
Cleanup host added as custom to Rancher 2.0
#!/bin/sh
# OUTDATED: please refer to the link below for the latest version:
# https://github.com/rancherlabs/support-tools/blob/master/extended-rancher-2-cleanup/extended-cleanup-rancher2.sh
docker rm -f $(docker ps -qa)
docker volume rm $(docker volume ls -q)
cleanupdirs="/var/lib/etcd /etc/kubernetes /etc/cni /opt/cni /var/lib/cni /var/run/calico /opt/rke"
for dir in $cleanupdirs; do
echo "Removing $dir"
rm -rf $dir
done
@kariae
kariae / .gitlab-ci.yml
Created June 6, 2017 17:29
GitLab CI/CD configuration for Symfony
variables:
REGISTRY_URL: registry.lekode.com:5000
IMAGE_NAME: app
BUILD_CODE_IMAGE: $REGISTRY_URL/$IMAGE_NAME:$CI_COMMIT_REF_NAME
LATEST_CODE_IMAGE: $REGISTRY_URL/$IMAGE_NAME:latest
stages:
- test
- install
- build
@iamniels
iamniels / Server side printing with Google Cloud Print API from a PHP application.md
Created April 15, 2016 09:59
Server side printing with Google Cloud Print API from a PHP application

Server side printing with Google Cloud Print API from a PHP application

It took me quite some time to figure out how to print properly from a web application. I will explain here how I did it, so you don't have to spend the same time.

Authorization

Google Cloud Print API uses OAuth 2.0 for authorization.

As explained [here][1] on the Google Developer page, the best way to use OAuth with the Google API is with a Google service account. Create a service account as explained on the Google Developer page.

To use OAuth a library is required. Google has published the [Google API PHP client library][2]. If you want to use the examples from the Developer pages, you need to use version 1 of the library. In this article I use version 2 of the library.

@micronax
micronax / unzip.php
Created December 28, 2015 19:09
Small PHP-Script with GUI to unzip files in current directory
<?php
echo '<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css"><link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">';
echo '<div class="container" style="margin-top:50px;">';
if (!class_exists('ZipArchive')) {
die("<h1>ZipArchive is not installed. Pleas echeck php.ini</h1>");
}
@alexclifford
alexclifford / s3_set_object_public.sh
Created July 24, 2015 01:59
Make S3 object public and private via s3cmd command line
s3cmd setacl s3://bucket/path/to/file --acl-public
s3cmd info s3://bucket/path/to/file
s3cmd setacl s3://bucket/path/to/file --acl-private
import android.util.Log;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
@micronax
micronax / truncate_shopware_db.sql
Last active August 29, 2015 14:22
Alle Shopware-Produkte aus der Datenbank entfernen. Dabei bleiben Kategorien, Configurator-Sets, Konfiguration usw. unangetastet.
SET FOREIGN_KEY_CHECKS = 0;
TRUNCATE TABLE `s_articles`;
TRUNCATE TABLE `s_articles_attributes`;
TRUNCATE TABLE `s_articles_categories`;
TRUNCATE TABLE `s_articles_categories_ro`;
TRUNCATE TABLE `s_articles_details`;
TRUNCATE TABLE `s_articles_img`;
TRUNCATE TABLE `s_articles_prices`;
TRUNCATE TABLE `s_articles_similar_shown_ro`;
TRUNCATE TABLE `s_articles_top_seller_ro`;
@nyg
nyg / iOSCreatePDF.swift
Last active April 2, 2024 11:09
iOS, Swift: Create a PDF file from an HTML string.
// Thanks to http://www.labs.saachitech.com/2012/10/23/pdf-generation-using-uiprintpagerenderer
// Note: including images in the HTML won't work, see here:
// https://github.com/nyg/HTMLWithImagesToPDF
import UIKit
// 1. Create a print formatter
let html = "<b>Hello <i>World!</i></b>"
let fmt = UIMarkupTextPrintFormatter(markupText: html)
@alexcristea
alexcristea / install-manifest.plist
Last active January 31, 2023 11:53
Over-the-Air Ad Hoc Distribution manifest for iOS8. More about this subject you can find on http://www.informit.com/articles/article.aspx?p=1829415&seqNum=16
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- array of downloads. -->
<key>items</key>
<array>
<dict>
<!-- an array of assets to download -->
2616 Aalräuchereien
4032 Abbaumaschinen
1056 Abbeizen
3390 Abbeizmittel
5523 Abbrucharbeiten
3762 Abbruchberatung
1 Abbruchfirma
4980 Abdeckplanen
1263 Abdichten
3221 Abendmoden