Skip to content

Instantly share code, notes, and snippets.

View thomaspockrandt's full-sized avatar
🔍
Focused

Thomas Pockrandt thomaspockrandt

🔍
Focused
View GitHub Profile
@thomaspockrandt
thomaspockrandt / Dockerfile
Last active December 19, 2021 17:53
Strapi v4 Docker files
ARG BASE_VERSION
FROM strapi/base:${BASE_VERSION}
ARG STRAPI_VERSION
RUN yarn global add @strapi/strapi@${STRAPI_VERSION}
RUN mkdir /srv/app && chown 1000:1000 -R /srv/app
WORKDIR /srv/app
@thomaspockrandt
thomaspockrandt / CaptureViewController.swift
Created October 28, 2017 02:53
CaptureViewController
import UIKit
import AVFoundation
class CaptureViewController: UIViewController {
var captureSession: AVCaptureSession?
var captureVideoPreviewLayer: AVCaptureVideoPreviewLayer?
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
@thomaspockrandt
thomaspockrandt / philips-hue-control.html
Last active May 16, 2019 01:54
Simple Philips Hue Control (jQuery)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Philips Hue Control</title>
<script src="http://code.jquery.com/jquery-3.1.1.min.js"></script>
<script type="text/javascript">
$(function() {
var apiBaseUrl = null;
@thomaspockrandt
thomaspockrandt / m3u_parser.swift
Created December 4, 2015 19:28
Simple Swift M3U Parser
if
let path = NSBundle.mainBundle().pathForResource("tvhd", ofType: "m3u"),
let content = try? String(contentsOfFile: path, encoding: NSUTF8StringEncoding)
{
let lines = content.componentsSeparatedByCharactersInSet(.newlineCharacterSet())
var streams = [String: NSURL]()
var streamName: String?
for line in lines {
if line.containsString("#") {
@thomaspockrandt
thomaspockrandt / wwdc15_session_videos_download.sh
Created June 21, 2015 08:55
Download all WWDC 2015 session videos w/ Terminal
HD
for i in `curl https://developer.apple.com/videos/wwdc/2015/ | grep -o '<a href="?id=[0-9]*' | cut -d '"' -f2`; do curl https://developer.apple.com/videos/wwdc/2015/${i} | grep -o 'http.*_hd_.*.mp4' | cut -d '"' -f5 | xargs curl -O; done
SD
for i in `curl https://developer.apple.com/videos/wwdc/2015/ | grep -o '<a href="?id=[0-9]*' | cut -d '"' -f2`; do curl https://developer.apple.com/videos/wwdc/2015/${i} | grep -o 'http.*_sd_.*.mp4' | cut -d '"' -f1 | xargs curl -O; done
var net = require("net");
var fs = require("fs");
// server
var port = "/tmp/stream";
var sockets = [];
var server = net.createServer(function(socket) {
sockets.push(socket);