Skip to content

Instantly share code, notes, and snippets.

<?
/////////////////////
// slack2html
// by @levelsio
/////////////////////
//
/////////////////////
// WHAT DOES THIS DO?
/////////////////////
//
@ipbastola
ipbastola / clean-up-boot-partition-ubuntu.md
Last active April 3, 2024 06:54
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 

Livestreaming via PS4 / Xbox to a local RTMP server

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
@hassy
hassy / parse_aws.md
Last active January 17, 2024 04:11
Deploying Parse Server on AWS (WIP)

Deploying Parse Server on AWS

Note: this is a work-in-progress and will be updated with more information over the next few days.

Intro

This guide will walk you through deploying your own instance of the open-source Parse Server. This would be a good starting point for testing your existing application to see if the functionality provided by the server is enough for your application, and to potentially plan your migration off the Parse Platform.

This guide will walk you through using Elastic Beanstalk (EB), which is an AWS service similar to Heroku. Why use EB rather than Heroku? Elastic Beanstalk does not lock you into Heroku-specific ways of doing things, is likely cheaper to run your backend on than Heroku, and it integrates with other services that AWS offer (and they offer almost everything one needs to run an application these days).

@cpmpercussion
cpmpercussion / loop_pi_video.sh
Created July 15, 2016 08:31
omxplayer command to loop a video forever for use in video art exhibitions
#!/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
@nitrag
nitrag / check_mk_agent-ubuntu-install.sh
Created March 6, 2018 03:04
Setup check_mk_agent via systemd on Ubuntu 16.04 (OMD, Check_MK)
# 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
@vinhnx
vinhnx / uicollectionview+snap.md
Last active May 26, 2023 06:40
UICollectionView snap onto cell when scrolling horizontally

// 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 {
@Tokuriku
Tokuriku / Count lines of code in Xcode project
Last active March 9, 2023 23:16 — forked from ccabanero/Count lines of code in Xcode project
Count lines of code in SWIFT Xcode project
1. Open Terminal
2. cd to your Xcode project
3. Execute the following when inside your target project:
find . -name "*.swift" -print0 | xargs -0 wc -l
@thayton
thayton / pgatour.py
Last active January 24, 2023 03:31
pga tour
#######################################################################
# Setup:
# $ python3 -m venv venv
# $ source venv/bin/activate
# $ pip install requests
# Usage:
# $ python pgatour.py
#######################################################################
import os
@droberin
droberin / fix_avatars.py
Created February 9, 2018 15:54
Slack exported conversation avatar replacement with locally downloaded avatars from original URL
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):