Skip to content

Instantly share code, notes, and snippets.

@nicksan2c
nicksan2c / top-level-dirs.sh
Last active March 19, 2024 22:09
top level synology directories
find / -mindepth 1 -maxdepth 1 -type d -not \( -path 'bin' -o -name 'boot' -o -name 'etc*' -o -name 'etc' -o -name 'initrd' -o -name 'mnt' -o -name 'root' -o -name 'tmp*' -o -name 'opt' -o -name 'lost+found' -o -name sys -o -name run -o -name var -o -name proc -o -name '.log.*' -o -name 'config' -o -name 'var*' -o -name '.old*' -o -name .syno -o -name .system_info -o -name dev -o -name usr -o -name home -o -name media -o -name srv \) -print | sort
@nicksan2c
nicksan2c / how-to-restore.md
Created October 21, 2021 00:35 — forked from AmazingTurtle/how-to-restore.md
restore access to unifi controller

Restore access to a unifi controller

When you are unable to login to the unifi controller or forgot admin password, you can restore access using SSH and manipulating mongodb directly.

Warning

Do not uninstall unifi controller - most of the data is not stored in mongodb. In case you thought a mongodb backup would be sufficient, you may have fucked up already, just like me. However I managed to write this "tutorial" for anyone to not run into the same trap.

Steps

Use Proxy for Git/GitHub

Generally, the Git proxy configuration depends on the Git Server Protocal you use. And there're two common protocals: SSH and HTTP/HTTPS. Both require a proxy setup already. In the following, I assume a SOCKS5 proxy set up on localhost:1080. But it can also be a HTTP proxy. I'll talk about how to set up a SOCKS5 proxy later.

SSH Protocol

When you do git clone ssh://[user@]server/project.git or git clone [user@]server:project.git, you're using the SSH protocal. You need to configurate your SSH client to use a proxy. Add the following to your SSH config file, say ~/.ssh/config:

ProxyCommand nc -x localhost:1080 %h %p
@nicksan2c
nicksan2c / secure-ssh.yml
Created March 15, 2020 12:44 — forked from cmavr8/secure-ssh.yml
Secure SSH configuration ansible playbook
---
# SSH server settings, in line with https://stribika.github.io/2015/01/04/secure-secure-shell.html
# Before using, change myhosts to your hosts' nickname and myuser to your username (two instances! make sure you replace both or you'll be locked out of ssh!)
- hosts: myhosts
become: true
remote_user: myuser
tasks:
# Key exchange, ciphers and MACs
- lineinfile: dest=/etc/ssh/sshd_config regexp='^KexAlgorithms' line='KexAlgorithms [email protected],diffie-hellman-group-exchange-sha256'
@nicksan2c
nicksan2c / ansbile_tips.yml
Created March 15, 2020 12:38 — forked from bmwant/ansbile_tips.yml
ansible quick tips for some modules
# Check existing
- name: Ansible check file exists.
stat:
path: /etc/filename
register: file_status
- debug:
msg: "File exists..."
when: file_status.stat.exists
- debug:
msg: "File not found"
@nicksan2c
nicksan2c / gist:6ac6af213e8a3ac68cf9a4b3c815176f
Created November 11, 2019 11:14 — forked from CristinaSolana/gist:1885435
Keeping a fork up to date

1. Clone your fork:

git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@nicksan2c
nicksan2c / README.md
Created November 6, 2018 19:26 — forked from magnetikonline/README.md
Bash array usage cheatsheet.
@nicksan2c
nicksan2c / dfs.txt
Created May 11, 2018 06:45
github projects on distributed storage and distributed file systems
DFS
https://github.com/topics/distributed-storage
https://github.com/topics/distributed-file-system
==================================================================
https://github.com/topics/distributed-storage
=>
@nicksan2c
nicksan2c / gdrive_download
Created April 16, 2018 03:59 — forked from darencard/gdrive_download
Script to download files from Google Drive using Bash
#!/usr/bin/env bash
# gdrive_download
#
# script to download Google Drive files from command line
# not guaranteed to work indefinitely
# taken from Stack Overflow answer:
# http://stackoverflow.com/a/38937732/7002068
gURL=$1
@nicksan2c
nicksan2c / transcode-install.sh
Created October 24, 2017 08:30 — forked from mmstick/transcode-install.sh
Ubuntu 10-bit HEVC Transcoding Tools -- Contains a script to install x265-10bit-git, libass-git, ffmpeg-git and bomi-git; another for updating everything; as well as scripts for transcoding videos with ffmpeg. Transcoding scripts require the fish shell to be installed.
#!/bin/bash
sourcedir="$HOME/.local/src/"
mkdir "$sourcedir"
export CFLAGS='-march=native -O3 -pipe -fstack-protector -Wall'
export CXXFLAGS='-march=native -O3 -pipe -fstack-protector -Wall'
function install-dependencies() {
# Install build tools and Mesa VDPAU support.
sudo apt-fast install -y cmake yasm autoconf build-essential mesa-vdpau-drivers \
libvdpau-va-gl1