Skip to content

Instantly share code, notes, and snippets.

View phedoreanu's full-sized avatar
🏠
Working from home

Adrian Fedoreanu phedoreanu

🏠
Working from home
View GitHub Profile
@phedoreanu
phedoreanu / alarm-rpi.sh
Last active June 23, 2018 20:05
Bootstrap sdcard with ArchLinuxARM for RaspberryPi 2/3
#!/bin/bash
DISK=$1
if [[ -z $DISK ]]; then
echo "Please supply the target disk i.e. /dev/sdb"
exit 1
fi
ALARM_VERSION=$2
if [[ -z $ALARM_VERSION ]]; then
ALARM_VERSION=3
@phedoreanu
phedoreanu / haproxy.conf
Last active April 14, 2018 10:03 — forked from thpham/haproxy.conf
test config haproxy for gRPC loadbalancing
global
tune.ssl.default-dh-param 2048
defaults
timeout queue 1m
timeout client 1m
timeout server 1m
timeout check 5s
timeout connect 10s
{
  "body": {
    "key": {
      "eldest_kid": "01209c3bacf85d26568e4b007aebb2e63c73ffabadefee3dd7d5de3e0f3dff56970b0a",
      "host": "keybase.io",
      "kid": "0120c3a12c2818a5313abf8cb9dfec2914b66b9a181fe0ba415c9ddd024923ddde4b0a",
      "uid": "1367b0ad193bb74c4e81578338381619",
      "username": "phedoreanu"
 },
package main
import (
"fmt"
"io/ioutil"
"bufio"
"bytes"
"strings"
"strconv"
)
#!/bin/sh
## Clean up any stale tempfile
echo "Removing old files..."
[ -f /tmp/hosts.working ] && rm -f /tmp/hosts.working
## Awk regex to be inverse-matched as whitelist
# - Project Wonderful does unobtrusive ads on a lot of webcomics
# - SolveMedia is needed for captchas on some websites
#whitelist='/(projectwonderful.com|api.solvemedia.com)/'
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo
# Dockerfile
FROM scratch
#ADD ca-certificates.crt /etc/ssl/certs
ADD app / # add binary
ENV LISTEN_PORT 7905
ENTRYPOINT [ "/app" ]
raspivid -o - -t 0 -fps 30 -b 6000000 | ffmpeg -re -ar 44100 -ac 2 -acodec pcm_s16le -f s16le -ac 2 -i /dev/zero -f h264 -i - -vcodec copy -acodec aac -ab 128k -g 50 -strict experimental -f flv rtmp://a.rtmp.youtube.com/live2/$KEY
./mjpg_streamer -o "output_http.so" -i "input_raspicam.so -x 1920 -y 1080 -fps 30"
sudo ./mjpg_streamer -i "input_uvc.so -d /dev/video1 -r 1280x720 -f 30 -q 85" -o "output_http.so"
sudo ffmpeg -f v4l2 -video_size 1920x1080 -i /dev/video0 -f v4l2 -video_size 1920x1080 -i /dev/video1 -filter_complex "[0:v]setpts=PTS-STARTPTS[background];[1:v]setpts=PTS-STARTPTS,scale=iw/2:-1[foreground];[background][foreground]overlay=main_w-overlay_w-10:main_h-overlay_h-10" -c:v libx264 -crf 18 -preset ultrafast -c:a copy output.mkv

Login

cf login -a https://api.run.pivotal.io -u [email protected]

Push a single app (with or without a manifest):

cf push APP_NAME [-b BUILDPACK_NAME] [-c COMMAND] [-d DOMAIN]

[-f MANIFEST_PATH] [--docker-image DOCKER_IMAGE]

[-i NUM_INSTANCES] [-k DISK] [-m MEMORY] [--hostname HOST] [-p PATH]
@phedoreanu
phedoreanu / pfblockerng_import_v3.php
Created September 7, 2016 14:49
pfBlockerNG import script
<?php
/*
pfBlockerNG_import.php
pfBlockerNG
Copyright (C) 2014 [email protected]
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
go fmt
warnings=`golint`
if [[ $warnings != "" ]]; then
echo $warnings
exit 1
fi
exit 0