Skip to content

Instantly share code, notes, and snippets.

View narate's full-sized avatar

Narate Ketram narate

View GitHub Profile
@narate
narate / netatalk-orange-pi-0.sh
Created January 20, 2019 14:58
Using Orange Pi Zero as macOS Time Machine Server
#!/bin/bash
apt-get install -y build-essential \
libevent-dev libssl-dev \
libgcrypt11-dev libkrb5-dev \
libpam0g-dev libwrap0-dev \
libdb-dev libtdb-dev avahi-daemon \
libavahi-client-dev libacl1-dev libldap2-dev \
libcrack2-dev systemtap-sdt-dev libdbus-1-dev \
libdbus-glib-1-dev libglib2.0-dev \
libio-socket-inet6-perl \
@narate
narate / keybase.md
Created March 17, 2018 03:03
Keybase

Keybase proof

I hereby claim:

  • I am narate on github.
  • I am r8s (https://keybase.io/r8s) on keybase.
  • I have a public key ASB9ZBOZMWbZ7-A3scztcIpDNupI3jSfmQM6kt9Ic-e2Pwo

To claim this, I am signing this object:

@narate
narate / ffplay-voov.sh
Created January 16, 2018 17:43
FFPLAY VOOV LIVE
#!/bin/bash
# Usage :
# ./ffplay-voov.sh 'http://www.voovlive.com/voov-web/share/index?room_id=200327322&anchor_id=601157725&lang=en&video_id=100990185'
M3U8=$(echo $1 | python -c 'import sys,re;print("http://5430.liveplay.myqcloud.com/voov/5430%s.m3u8"%re.match(".*video_id=(\d+)",sys.stdin.read()).groups()[0])')
ffplay $M3U8
@narate
narate / htpasswd.sh
Created January 13, 2018 11:16
Generate basic auth username and password.
#!/bin/bash
USERNAME=$1
printf "$USERNAME:`openssl passwd -apr1`\n"
@narate
narate / Dockerfile
Created January 12, 2018 06:12
Just a Dockerfile to build php7 with composer, nginx, and openssh-server. Please use this Dockerfile for development only
FROM php:7-fpm
MAINTAINER Narate Ketram <rate@tel.co.th>
RUN apt-get update && apt-get install openssh-server nginx-extras vim zlib1g-dev -y
RUN docker-php-ext-install zip
RUN cd /tmp && php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" && php composer-setup.php && php -r "unlink('composer-setup.php');"
RUN cp /tmp/composer.phar /usr/bin/composer
@narate
narate / ffmpeg-blur-video.sh
Last active December 18, 2017 14:53
Blur video using FFMPEG
ffmpeg -i $1 -filter_complex \
"[0:v]crop=350:40:100:60,boxblur=10[fg]; \
[0:v][fg]overlay=90:62[v]" \
-map "[v]" -map 0:a -c:v libx264 -c:a copy -movflags +faststart $2
@narate
narate / vibie.play
Last active January 17, 2018 16:50
ffplay live from vibie.live required ffmpeg --with-ffplay and jq
#!/bin/bash
LIVE_DATA=$(curl -s "$1" | grep __NEXT_DATA__ | sed 's/__NEXT_DATA__ =//g')
STATUS=$(echo $LIVE_DATA | jq '.props.live.status' | sed 's/"//g')
if [ $STATUS == "inactive" ]
then
echo "ERROR: live status is $STATUS"
exit -1
fi
@narate
narate / 131AM.itermcolors
Created September 14, 2017 18:34
Just an iTerm2 color-scheme
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.12343787401914597</real>
@narate
narate / url-decoder.py
Created August 11, 2017 04:17
URL decoder command line toots written in Python
#!/usr/bin/env python
'''
Usage :
$ echo encoded_url | python url-decoder.py
'''
import sys
import urllib
data = sys.stdin.read()
@narate
narate / docker_service_report.py
Last active August 12, 2023 08:07
Show all running docker services details for usable Copy and Paste
import docker
import json
def to_mounts_string(mounts):
l = []
for m in mounts:
l.append('Type = {}, Source = {}, Target = {}'
.format(m.get('Type'), m.get('Source'), m.get('Target')))
return json.dumps(l, sort_keys=True, indent=4, ensure_ascii=False)