Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
sad, ttyS0 has been taken by other user

ttys3

💭
sad, ttyS0 has been taken by other user
View GitHub Profile
@ttys3
ttys3 / merge_git_repo_as_subdir
Created Jun 23, 2019 — forked from smdabdoub/merge_git_repo_as_subdir
Merge one git repository into another repository as a sub-directory
View merge_git_repo_as_subdir
# based on the following:
# http://saintgimp.org/2013/01/22/merging-two-git-repositories-into-one-repository-without-losing-file-history/
# http://blog.caplin.com/2013/09/18/merging-two-git-repositories/
git clone repo_main
git clone repo_sub
cd repo_main
git remote add repo_sub ../repo_sub
git fetch repo_sub
View self-signed-certificate-with-custom-ca.md

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@ttys3
ttys3 / TrueColour.md
Created Jul 30, 2019 — forked from XVilka/TrueColour.md
True Colour (16 million colours) support in various terminal applications and terminals
View TrueColour.md

Terminal Colors

There exists common confusion about terminal colors. This is what we have right now:

  • Plain ASCII
  • ANSI escape codes: 16 color codes with bold/italic and background
  • 256 color palette: 216 colors + 16 ANSI + 24 gray (colors are 24-bit)
  • 24-bit true color: "888" colors (aka 16 milion)
@ttys3
ttys3 / README.md
Created Sep 3, 2019 — forked from garthk/README.md
Fixing Docker on QNAP
View README.md
$ export DOCKER_HOST=tcp://fnord.local:2376 DOCKER_TLS_VERIFY=1
$ docker ps
An error occurred trying to connect: Get https://fnord.local:2376/v1.21/containers/json: x509: certificate is valid for fnord, 192.168.23.23 , localhost, not fnord.local
$ ssh admin@fnord.local
# /sbin/setcfg global realm local -f /etc/config/smb.conf
# /etc/init.d/network.sh restart
# hostname -f
fnord.local
# cd $(dirname $(readlink /etc/init.d/container-station.sh))
@ttys3
ttys3 / diskusage.go
Last active Jan 26, 2022 — forked from lunny/diskinfo.go
Disk Usage info like `df -h` for Golang
View diskusage.go
package main
import (
"fmt"
syscall "golang.org/x/sys/unix"
)
type DiskStatus struct {
All uint64 `json:"all"`
Used uint64 `json:"used"`
@ttys3
ttys3 / why phpbb has failed the open source movement.md
Last active Apr 1, 2021 — forked from damianb/gist:1515305
why phpbb has failed the open source movement
View why phpbb has failed the open source movement.md
@ttys3
ttys3 / authserver.go
Created Nov 23, 2019 — forked from elithrar/authserver.go
HTTP Basic Auth example in Go (based on http://stackoverflow.com/a/21937924/556573 + bespoke middleware implementation)
View authserver.go
package main
import (
"encoding/base64"
"github.com/gorilla/mux"
"net/http"
"strings"
)
func main() {
View deluge_tracker_rename.py
#!/usr/bin/env python2
#
# Find and replace tracker urls in a Deluge torrents.state
import os
import sys
import platform
import shutil
import cPickle
@ttys3
ttys3 / systemd_service_hardening.md
Created Dec 3, 2019 — forked from ageis/systemd_service_hardening.md
Options for hardening systemd service units
View systemd_service_hardening.md

security and hardening options for systemd service units

A common and reliable pattern in service unit files is thus:

NoNewPrivileges=yes
PrivateTmp=yes
PrivateDevices=yes
DevicePolicy=closed
ProtectSystem=strict
@ttys3
ttys3 / post-receive
Created Dec 6, 2019 — forked from lemiorhan/post-receive
Post-receive hook to deploy the code being pushed to production branch to a specific folder
View post-receive
#!/bin/bash
target_branch="production"
working_tree="PATH_TO_DEPLOY"
while read oldrev newrev refname
do
branch=$(git rev-parse --symbolic --abbrev-ref $refname)
if [ -n "$branch" ] && [ "$target_branch" == "$branch" ]; then