Live stream from your PS4 / Xbox to a local computer running an RTMP server by intercepting the twitch.tv stream.
Requirements
- DD-WRT enabled Router (or router with iptables compatibility)
- nix Envirment
- nginx with the nginx-rtmp-module
####################################################################### | |
# Setup: | |
# $ python3 -m venv venv | |
# $ source venv/bin/activate | |
# $ pip install requests | |
# Usage: | |
# $ python pgatour.py | |
####################################################################### | |
import os |
from enum import Enum, EnumMeta | |
class ChoiceEnumMeta(EnumMeta): | |
def __iter__(self): | |
return ((tag, tag.value) for tag in super().__iter__()) | |
class ChoiceEnum(Enum, metaclass=ChoiceEnumMeta): | |
""" |
# How to install Check MK Agent on ubuntu 16.04 | |
# Install check_mk_agent: | |
# - sudo apt-get install check-mk-agent (will install older version) | |
# - On your Check_MK dashboard, go to "Monitoring Agents", click the link for "Check_MK Agent for Linux", save the raw text | |
# on your server: | |
sudo vi /usr/bin/check_mk_agent | |
# paste Check_MK dashboard > Monitoring Agents > Check_MK Agent for Linux |
import os | |
import lxml.html as LH | |
import shutil | |
import requests | |
temp_dir = "/tmp/avatar_tmp" | |
if not os.path.isdir("html/avatars"): | |
os.mkdir("html/avatars") | |
if os.path.isdir(temp_dir): |
// reference: https://stackoverflow.com/a/43637969/1477298
While originally I was using Objective-C, I since switched so Swift and the original accepted answer did not suffice.
I ended up creating a UICollectionViewLayout subclass which provides the best (imo) experience as opposed to the other functions which alter content offset or something similar when the user has stopped scrolling.
class SnappingCollectionViewLayout: UICollectionViewFlowLayout {
override func targetContentOffset(forProposedContentOffset proposedContentOffset: CGPoint, withScrollingVelocity velocity: CGPoint) -> CGPoint {
func mapViewDidFinishLoadingMap(_ mapView: MGLMapView) {
let source = MGLSource(sourceIdentifier: "source")!
let symbolLayer = MGLSymbolStyleLayer(layerIdentifier: "place-city-sm", source: source)
let url = URL(string: "https://www.mapbox.com/mapbox-gl-js/assets/earthquakes.geojson")!
let options = [MGLGeoJSONClusterOption: NSNumber(booleanLiteral: true),
MGLGeoJSONClusterRadiusOption: NSNumber(integerLiteral: 20),
MGLGeoJSONClusterMaximumZoomLevelOption: NSNumber(integerLiteral: 15)]
let geoJSONSource = MGLGeoJSONSource(sourceIdentifier: "earthquakes", url: url, options: options)
$ uname -r
#!/bin/bash | |
# This one-liner script plays a video in an infinite loop on a raspberry pi | |
# for a video-art exhibition. | |
# It was written for a video in portrait orientation so the video is rotated 270 | |
# to use up the whole screen (which was also rotated). | |
# Charles Martin, July 2016 | |
omxplayer -o local --loop /home/pi/video.mp4 --orientation 270 |
extension PHPhotoLibrary { | |
typealias PhotoAsset = PHAsset | |
typealias PhotoAlbum = PHAssetCollection | |
static func saveImage(image: UIImage, albumName: String, completion: (PHAsset?)->()) { | |
if let album = self.findAlbum(albumName) { | |
saveImage(image, album: album, completion: completion) | |
return | |
} |