Skip to content

Instantly share code, notes, and snippets.

View WanpengQian's full-sized avatar
👳‍♀️

Wanpeng Qian WanpengQian

👳‍♀️
  • Fukuoka, Japan
View GitHub Profile
@ysarro
ysarro / PPPoE on FreeBSD
Created January 31, 2011 16:20
PPPoE on FreeBSD
/etc/ppp/ppp.conf
default:
set device PPPoE:<interface connected to modem>:<profile name>:
<profile name>:
set authname <pppoe username>
set authkey <pppoe password>
add default HISADDR
@TravisTroyer
TravisTroyer / SambaOnFreeBsd.md
Last active August 16, 2017 21:34
Samba 4.1 on FreeBSD 10.1

Samba 4.1 Active Directory Domain Controller on FreeBSD 10.1

To simplify home network management, I recently decommissioned my beefy domain controller/file server/Hyper-V host, moving mass file storage to the cloud. I thought I could live without Active Directory, but with 5 PCs and a couple of Windows tablets, I want it back, so my plan is to host a tiny VM instance in hyper-V on 4 of my desktop PCs, creating something like peer-to-peer AD (hopefully with little overhead).

Resources

The following references were incredibly helpful, but neither were perfect for getting up and running quickly, hence this gist.

@petervanderdoes
petervanderdoes / zfs_health.sh
Last active July 4, 2024 10:08
ZFS Health Check Script
#! /usr/local/bin/bash
#
# Calomel.org
# https://calomel.org/zfs_health_check_script.html
# FreeBSD 9.1 ZFS Health Check script
# zfs_health.sh @ Version 0.15
# Check health of ZFS volumes and drives. On any faults send email. In FreeBSD
# 10 there is supposed to be a ZFSd daemon to monitor the health of the ZFS
# pools. For now, in FreeBSD 9, we will make our own checks and run this script
@moisseev
moisseev / patch-source3_modules_vfs__shadow__copy2.c
Last active May 16, 2017 13:31
[partial fix] CVE-2015-5299 denies access to ZFS snapshots due to overly strict condition checking (the patch is against Samba 4.4.13)
--- source3/modules/vfs_shadow_copy2.c.orig 2017-04-02 08:19:24 UTC
+++ source3/modules/vfs_shadow_copy2.c
@@ -1533,7 +1533,7 @@ static bool check_access_snapdir(struct
&smb_fname,
false,
SEC_DIR_LIST);
- if (!NT_STATUS_IS_OK(status)) {
+ if (NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED)) {
DEBUG(0,("user does not have list permission "
"on snapdir %s\n",
#include <memory>
#include <cassert>
#include <Windows.h>
struct FileHandle
{
::HANDLE fileHandle;
//implicit
FileHandle(::HANDLE h) noexcept
@shimizu
shimizu / .block
Last active February 25, 2023 11:21
D3.js v4 Mapping Tutorial : TopoJSON
license: mit
@Zitrax
Zitrax / stringformat_constexpr_if.cpp
Last active November 7, 2023 23:06
stringformat with constexpr if
#include <string>
#include <iostream>
#include <memory>
/**
* Convert all std::strings to const char* using constexpr if (C++17)
*/
template<typename T>
auto convert(T&& t) {
@joseluisq
joseluisq / stash_dropped.md
Last active July 16, 2024 11:38
How to recover a dropped stash in Git?

How to recover a dropped stash in Git?

1. Find the stash commits

git log --graph --oneline --decorate ( git fsck --no-reflog | awk '/dangling commit/ {print $3}' )

This will show you all the commits at the tips of your commit graph which are no longer referenced from any branch or tag – every lost commit, including every stash commit you’ve ever created, will be somewhere in that graph.

@JustThomas
JustThomas / nginx_remove_double_slashes.md
Created February 4, 2018 17:16
nginx: Remove double slashes from URLs

Put the following directives in your server block. nginx will then redirect URLs with double (or triple or multiple) slashes to the corresponding URL with a single slash.

merge_slashes off;
rewrite ^(.*?)//+(.*?)$ $1/$2 permanent;
@Andrew-Reid
Andrew-Reid / d3-cluster.js
Last active December 8, 2023 02:48
D3 Marker Clustering
// https://d3js.org/d3-force/ Version 1.1.0. Copyright 2017 Mike Bostock.
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-quadtree'), require('d3-collection'), require('d3-dispatch'), require('d3-timer')) :
typeof define === 'function' && define.amd ? define(['exports', 'd3-quadtree', 'd3-collection', 'd3-dispatch', 'd3-timer'], factory) :
(factory((global.d3 = global.d3 || {}),global.d3,global.d3,global.d3,global.d3));
}(this, (function (exports,d3Quadtree,d3Collection,d3Dispatch,d3Timer) { 'use strict';
var constant = function(x) {
return function() {