Skip to content

Instantly share code, notes, and snippets.

@refo
refo / Linux Notes.md
Last active February 2, 2018 12:00
Linux notes
import React from 'react';
export default class ComponentName extends React.Component {
componentDidMount() {
let children = this.collectChildren(this, (child) => {
return 'object' === typeof child;
});
children = children.map(child => {
@refo
refo / slugify.py
Created May 18, 2017 10:40
Automate title to slug process.
# pip install django
# pip install clipboard
# pip install unidecode
from django.template import defaultfilters
import clipboard
from unidecode import unidecode
while True:
title = input("Input title: ")
@refo
refo / createcertfilesfrompfx.sh
Created August 3, 2018 07:35
Create nginx cert files (pem, key) from pfx
#!/bin/bash
# Source:
# https://gist.github.com/ericharth/8334664
#
# Thanks:
# https://github.com/anderssonjohan
#
# Usage:
# ./createcertfilesfrompfx.sh /path/to/domain.pfx
#
@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
@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 / 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 / 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 / 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 / iphone simulator fullscreen.sh
Created February 20, 2020 13:00
iphone simulator fullscreen (AllowFullscreenMode)
defaults write com.apple.iphonesimulator AllowFullscreenMode -bool YES