Skip to content

Instantly share code, notes, and snippets.

View ofstudio's full-sized avatar

Oleg Fomin ofstudio

View GitHub Profile
@ofstudio
ofstudio / usb-rtlsdr-docker-rootless.sh
Created October 17, 2021 20:29
How to mount USB device to docker container in rootless mode
# How to mount RTL-SDR (Flightaware) USB dongle
# to docker container in rootless mode
#
# For example running: `docker run --device=/dev/bus/usb:/dev/bus/usb ...`
#
# or via docker compose:
#
# version: '3'
# services:
# dump1090:
@ofstudio
ofstudio / get_password.sh
Created December 14, 2014 16:39
Get password from OS X Keychain shell / bash function
# Get password from OS X Keychain function
# Replace %ACCOUNT_NAME% with account name of Keychain item
# See `man security` for more info
get_pw () {
security 2>&1 >/dev/null find-generic-password -ga "%ACCOUNT_NAME%" \
| sed 's/password: "\(.*\)"/\1/'
}
# Don't store server credentials in plain text!
PASS=$(get_pw)
@ofstudio
ofstudio / heplers.js
Last active September 9, 2021 09:55
Couple useful heplers for ghost
var hbs = require('express-hbs'),
api = require('core/server/api'),
_ = require('lodash'),
async = require('express-hbs/lib/async'), // To redefine `registerAsyncHelper`
registerAsyncHelper;
// Redefine `registerAsyncHelper` from `express-hbs`
registerAsyncHelper = function (name, fn) {
hbs.handlebars.registerHelper(name, function (context, options) {
// Pass `[context, options]` as arg instead of `context` only
@ofstudio
ofstudio / meta.hbs
Created January 6, 2015 13:43
Meta tags snippet for Ghost Themes
{{!-- Tested on Ghost 0.5.7. --}}
{{!-- IMPORTANT! Some things are more likely to work in a different way in future versions of Ghost. Check the documentation --}}
{{#is "index, tag, author"}} {{!-- Meta for index, tag and author contexts --}}
{{#is "index"}}
<title>{{@blog.title}}</title>
<meta name="description" content="{{@blog.description}}"/>
<meta property="og:title" content="{{@blog.title}}"/>
<meta itemprop="name" content="{{@blog.title}}"/>
{{/is}}
{{#is "tag"}}
@ofstudio
ofstudio / bear-crash-report.md
Created March 3, 2019 18:05
Bear Crash Report
Process:               Bear [546]
Path:                  /Applications/Bear.app/Contents/MacOS/Bear
Identifier:            net.shinyfrog.bear
Version:               1.6.10 (7071)
App Item ID:           1091189122
App External ID:       830211213
Code Type:             X86-64 (Native)
Parent Process:        ??? [1]
Responsible:           Bear [546]
@ofstudio
ofstudio / OSAjs-itunes.js
Created December 28, 2014 12:01
Example of iTunes scripting in OS X with Javascript
/**
* Example of iTunes scripting in OS X with Javascript
* Open /Applications/Script Editor.app, paste the code and click Run button
*
* @author Oleg Fomin <ofstudio@gmail.com>
*
*/
var my_app = Application.currentApplication(),
itunes = new Application('iTunes'),
<iframe
src="//vk.com/video_ext.php?oid=-93834542&id=456239311&hash=4e0152fb103f7d48"
width="426" height="240"
frameborder="0"
allowfullscreen></iframe>
@ofstudio
ofstudio / wcschat_topics.md
Last active June 19, 2018 14:31
Список тем Большого WCS Чата
@ofstudio
ofstudio / espressodance.com.conf
Created December 4, 2017 07:28
Sample Nginx reverse proxy configuration with websockets
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 80;
listen [::]:80;
server_name live.wcs.life;
return 301 https://$host$request_uri;
@ofstudio
ofstudio / openvpn-docker.sh
Created October 30, 2017 18:57
Run OpenVPN Server in Docker container
#!/usr/bin/env bash
# https://hub.docker.com/r/kylemanna/openvpn/
OVPN_DATA="openvpn_data" # Docker volume name
OVPN_HOST="vpn.hostname.org" # Server hostname
OVPN_USER="peter_the_pig" # Client username
# init
docker volume create --name $OVPN_DATA