Skip to content

Instantly share code, notes, and snippets.

View felixbuenemann's full-sized avatar
💭
I may be slow to respond.

Felix Bünemann felixbuenemann

💭
I may be slow to respond.
View GitHub Profile
@DrHayt
DrHayt / cloud-config.yml
Last active January 20, 2021 12:03
CoreOS Container Linux etcd3 cluster cloud-config with SSL on peer, server, and client configs.
#cloud-config
ssh_authorized_keys:
- ssh-rsa PutYourKeysHere
coreos:
locksmith:
endpoint: "https://127.0.0.1:2379"
etcd_cafile: /etc/ssl/certs/ca.pem
etcd_certfile: /etc/ssl/client/client.pem
etcd_keyfile: /etc/ssl/client/client.key
@ipedrazas
ipedrazas / k8s-svc-annotations.md
Created February 20, 2017 11:20
AWS Service annotations
  • service.beta.kubernetes.io/aws-load-balancer-access-log-emit-interval (in minutes)
  • service.beta.kubernetes.io/aws-load-balancer-access-log-enabled (true|false)
  • service.beta.kubernetes.io/aws-load-balancer-access-log-s3-bucket-name
  • service.beta.kubernetes.io/aws-load-balancer-access-log-s3-bucket-prefix
  • service.beta.kubernetes.io/aws-load-balancer-backend-protocol (http|https|ssl|tcp)
  • service.beta.kubernetes.io/aws-load-balancer-connection-draining-enabled (true|false)
  • service.beta.kubernetes.io/aws-load-balancer-connection-draining-timeout (in seconds)
@toddhopkinson
toddhopkinson / BackgroundTransferSample.swift
Last active September 27, 2023 01:47
Upload Very Large Files In Background on iOS - Alamofire.upload multipart in background
// You have a very very large video file you need to upload to a server while your app is backgrounded.
// Solve by using URLSession background functionality. I will here use Alamofire to enable multipart upload.
class Networking {
static let sharedInstance = Networking()
public var sessionManager: Alamofire.SessionManager // most of your web service clients will call through sessionManager
public var backgroundSessionManager: Alamofire.SessionManager // your web services you intend to keep running when the system backgrounds your app will use this
private init() {
self.sessionManager = Alamofire.SessionManager(configuration: URLSessionConfiguration.default)
self.backgroundSessionManager = Alamofire.SessionManager(configuration: URLSessionConfiguration.background(withIdentifier: "com.lava.app.backgroundtransfer"))
@conundrumer
conundrumer / iterators.rs
Created November 22, 2016 21:16
returning iterators in rust
#![feature(conservative_impl_trait)]
// without impl trait or box
use std::iter::{ FlatMap, Map, Enumerate, Iterator };
use std::str::Chars;
type GetIterFnType = Fn((usize, char)) -> Option<char>;
type IdentityType = Fn(Option<char>) -> Option<char>;
type GetIterType<'a> = FlatMap<Map<Enumerate<Chars<'a>>, &'static GetIterFnType>, Option<char>, &'static IdentityType>;
const GET_ITER_FN: &'static GetIterFnType = &|(i, x)| if i % 2 == 0 { Some(x) } else { None };
@cedricziel
cedricziel / CustomerAutocompletion.php
Created November 4, 2016 14:40
TYPO3 CMS 7 fully loaded TSFE in EiD
<?php
namespace Project\Namespace\Hooks;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Core\Bootstrap;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
@suyash
suyash / README.md
Last active September 1, 2021 15:26
mmap examples

identical mmap programs in C and go

@jcupitt
jcupitt / trans.cpp
Created May 29, 2016 09:18
combine two alpha channels with vips
/* compile with
*
* g++ trans.cpp `pkg-config vips-cpp --cflags --libs`
*/
#include <vips/vips8>
using namespace vips;
/* Return the image alpha maximum. Useful for combining alpha bands. scRGB
@fernandoaleman
fernandoaleman / fix-libv8-mac.txt
Created May 5, 2016 15:14
Fixing libv8 and therubyracer on Mac
brew tap homebrew/versions
brew install v8-315
gem install libv8 -v '3.16.14.13' -- --with-system-v8
gem install therubyracer -- --with-v8-dir=/usr/local/opt/v8-315
bundle install
@kennwhite
kennwhite / Launch_Alpine_Linux_3.3.x_on_AWS.md
Last active December 15, 2017 14:57
Launch Alpine Linux 3.3.x on Amazon Web Services

Launch_Alpine_Linux_3.3.x_on_AWS.md

Create a local VM of Alpine Linux, eg: https://gist.github.com/kennwhite/959d47a77070d365ad60

  • On your workstation open a terminal and create a new ssh keypair:

    ssh-keygen -t rsa -b 4096 -C "alpine@example.com"

    • Set a meaningful keypair base file name when prompted, eg: alpine-test
sub vcl_hit {
if (obj.ttl >= 0s) {
# normal hit
return (deliver);
}
# We have no fresh fish. Lets look at the stale ones.
if (std.healthy(req.backend_hint)) {
# Backend is healthy. Limit age to 10s.
if (obj.ttl + 10s > 0s) {
set req.http.grace = "normal(limited)";