Skip to content

Instantly share code, notes, and snippets.

@refo
refo / Enable sftp for ubuntu user.md
Last active December 1, 2020 16:33
Enable sftp for ubuntu user

sshd configuration

Assuming username is blog and target folder is /home/blog

Make sure user blog is exists and necessary permissions for the target folder is already set.

sudo nano /etc/ssh/sshd_config.d/blog.conf
@refo
refo / npm-release.md
Created July 5, 2020 15:43
NPM bump version and release
@refo
refo / raspberry_print_temp_json.md
Last active July 1, 2020 14:49
Print raspberry pi gpu and cpu temperatures in json format

Installation

Paste the script to /usr/bin/temp and make it executable

# copy the contents of "raspberry_print_temp_json.sh"
sudo nano /usr/bin/temp
# paste
# ctrl + o
# enter

Build Dockerfile-custom, tag the image

docker build -t hebelek_custom -f Dockerfile-hebelek .

Check if you can access another container

host=db; port=3306; (echo >/dev/tcp/${host}/${port}) &>/dev/null && echo "open" || echo "closed"
@refo
refo / iphone simulator fullscreen.sh
Created February 20, 2020 13:00
iphone simulator fullscreen (AllowFullscreenMode)
defaults write com.apple.iphonesimulator AllowFullscreenMode -bool YES
@refo
refo / macOS proxy settings from terminal.md
Last active January 23, 2023 17:05
macOS proxy settings from terminal

macOS firewall settings

Set socks proxy

networksetup -setsocksfirewallproxy Wi-Fi 127.0.0.1 7070

Get current socks proxy settings and state

networksetup -getsocksfirewallproxy Wi-Fi
@refo
refo / docker-compose.yaml
Created May 17, 2019 05:01
Plexpi, Raspberry pi,plex sonarr, deluge and friends
version: "2"
services:
# https://hub.docker.com/r/linuxserver/plex
plex:
image: linuxserver/plex
container_name: plexpi
network_mode: host
environment:
- PUID=1000
@refo
refo / Extracting Certificate and Private Key Files from a .pfx File.md
Last active April 1, 2019 07:39
Extracting Certificate and Private Key Files from a .pfx File

Requirements

System with OpenSSL installed

Introduction

The *.pfx file is in PKCS#12 format and includes both the certificate and the private key. More information about the format could be found here

Export the Private Key

openssl pkcs12 -in certname.pfx -nocerts -out key.pem -nodes
@refo
refo / tag.js
Created February 1, 2019 10:48
CalVer versioning helper
const {exec} = require('child_process');
const moment = require('moment');
run('git describe')
.then(parseDescribe)
.catch(showError);
function parseDescribe(desc) {
const [tag, numOfCommits, lastCommit] = desc.trim().split('-');
@refo
refo / basic_file_read.py
Created January 10, 2019 11:30
Basic file reading, writing and argument operations in python
#!/usr/bin/env python2.7
import sys, os
fileName = sys.argv[1] if len(sys.argv) > 1 else "default"
cwd = os.getcwd()
path = os.path.join(cwd, "{}.txt".format(fileName))
print "File:"
print path