Skip to content

Instantly share code, notes, and snippets.

View bohanyang's full-sized avatar

Brent Yang bohanyang

View GitHub Profile
@piotrkundu
piotrkundu / msys2_with_git_for_windows.md
Last active June 15, 2024 09:12
Full MINGW64 environtment with MSYS2 instead of Git Bash for Windows

BACKGROUND (WHY?)

I switch dev-environments every single year with each customer having their own setup. Git on Linux and MacOSX just works most of the time - there are some SSH keys needed to be setup, but "sudo apt-get" or "brew install" mostly does the trick.

Git for Windows is a box a sourcery, so when you install that you will get a version of slim MSYS2, MinGW64 and most importantly bash and git that runs from the bash. This is what you need 9 out of 10 times, if you ONLY need to use git to manage your source and then use other/external toolchains like VS Code, VS2022 or Windows Powershell or Command to compile your sh.ttt I mean stuff.

Then that 10th out of 10 times, you want to compile windows applications from the same terminal that you run git - just like you do on linux or OSX. If you are running Windows alone then having two terminals, one for git (with mingw64/msys2) and one for your ms whatever the compiler name is for C++.

@xgugeng
xgugeng / seafile-caddy.conf
Last active May 25, 2024 08:33
Caddyfile for Seafile
seafile.example.com {
log {
output file /var/log/caddy/seafile.log
}
# Optional for Cloudflare
tls {
dns cloudflare {env.CF_API_TOKEN}
}
@matusnovak
matusnovak / README.md
Last active June 17, 2024 18:31
GPG + Git SSH Authentication and Signing on Windows 10

GPG + Git SSH Authentication and Signing on Windows 10

Introduction

This simple Gist will explain how to settup your GPG key to work for SSH authentication (with Git) and Git commit signing on Windows 10. This may seem straightforward on Linux, but there are certain tweaks needed on Windows.

No Cygwin, no MinGW, no Git Bash or any other Linux emulated environment. This works in pure Windows 10.

Software needed

@ragboyjr
ragboyjr / AbstractCrudDTOController.php
Last active February 15, 2024 13:16
Easy Admin 3 DTO Crud Controller
<?php
namespace App\EasyAdminExtensions\Controller;
use EasyCorp\Bundle\EasyAdminBundle\Config\Action;
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
use EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto;
use EasyCorp\Bundle\EasyAdminBundle\Event\BeforeCrudActionEvent;
use EasyCorp\Bundle\EasyAdminBundle\Event\BeforeEntityPersistedEvent;
use EasyCorp\Bundle\EasyAdminBundle\Event\BeforeEntityUpdatedEvent;
@liberal-boy
liberal-boy / HaProxy 通过 Domain Socket 与 V2Ray 通讯.md
Last active September 5, 2023 19:46
HaProxy 通过 Domain Socket 与 V2Ray 通讯

HaProxy 通过 Domain Socket 与 V2Ray 通讯

本文供高级玩家阅读,请先阅读 Vmess + TCP + TLS 方式的 HTTP 分流和网站伪装。 相比 TCP,Domain Socket 更为高效。 本文针对使用 Debian 10 的用户,其他系统请自行摸索。

预先准备

  1. 首先按照先前的教程安装好 HaProxy 和 V2Ray。

  2. 修改以下文件,示例见下方

  • /etc/haproxy/haproxy.cfg
@kekru
kekru / 01nginx-tls-sni.md
Last active June 19, 2024 17:24
nginx TLS SNI routing, based on subdomain pattern

Nginx TLS SNI routing, based on subdomain pattern

Nginx can be configured to route to a backend, based on the server's domain name, which is included in the SSL/TLS handshake (Server Name Indication, SNI).
This works for http upstream servers, but also for other protocols, that can be secured with TLS.

prerequisites

  • at least nginx 1.15.9 to use variables in ssl_certificate and ssl_certificate_key.
  • check nginx -V for the following:
    ...
    TLS SNI support enabled
@eduncan911
eduncan911 / go-build-all
Last active April 11, 2024 07:14
Go Cross-Compile Script
#!/bin/bash
#
# GoLang cross-compile snippet for Go 1.6+ based loosely on Dave Chaney's cross-compile script:
# http://dave.cheney.net/2012/09/08/an-introduction-to-cross-compilation-with-go
#
# To use:
#
# $ cd ~/path-to/my-awesome-project
# $ go-build-all
#
@vladimirtsyupko
vladimirtsyupko / gist:10964772
Created April 17, 2014 08:32
Git force pull to overwrite local files
git fetch --all
git reset --hard origin/master
git pull origin master
@robertstarmer
robertstarmer / ubuntu-server.preseed
Last active August 25, 2022 10:06
example preseed for OpenStack deployment
d-i mirror/country string manual
d-i mirror/http/hostname string 192.168.26.170
d-i mirror/http/directory string /ubuntu
d-i partman/early_command string vgs --separator=: --noheadings | cut -f1 -d: |while read vg ; do vgchange -an $vg ; done ; pvs --separator=: --noheadings | cut -f1 -d: | while read pv ; do pvremove -ff -y $pv ; done
d-i partman-auto/disk string /dev/sda
d-i partman/alignment string cylinder
d-i partman-md/device_remove_md boolean true
d-i partman-md/confirm boolean true
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-lvm/confirm boolean true
@robinsmidsrod
robinsmidsrod / dhcpd.conf
Last active June 11, 2024 13:10
Trying to chainload iPXE with full feature set from a lesser featured one, whilst still being able to boot non-supported cards with UNDI
ddns-update-style none;
deny bootp; #default
authoritative;
include "/etc/dhcp/ipxe-option-space.conf";
# GREEN (private network)
subnet 10.1.1.0 netmask 255.255.255.0 {
range 10.1.1.100 10.1.1.199;
option subnet-mask 255.255.255.0;