This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess | |
import os | |
import re | |
import json | |
import logging | |
import argparse | |
from datetime import datetime | |
def get_author_stat(path: str, since: str, until: str) -> str: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use core::mem::size_of; | |
use redbpf_probes::xdp::prelude::*; | |
const RTE_IPV4_HDR_IHL_MASK: u8 = 0x0f; | |
const RTE_IPV4_IHL_MULTIPLIER: u8 = 4; | |
pub unsafe fn rte_ipv4_hdr_len(ipv4_hdr: *const iphdr) -> u8 { | |
let tmp = (((*ipv4_hdr).ihl() & RTE_IPV4_HDR_IHL_MASK) * RTE_IPV4_IHL_MULTIPLIER) as u8; | |
_ = printk!("csum_dpdk: ipv4_hdr_len: %d", tmp); | |
tmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"log" | |
httpcli "moservice/lib/net" | |
"net/http" | |
"sync" | |
"time" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usage: bash mon.sh short-hostname | |
# You should first change the node's hostname, e.g. | |
# hostnamectl set-hostname mon1.ceph | |
# Then add it to ~/.ssh/config, e.g. | |
# Host mon1 | |
dst=$1 | |
ssh $dst systemctl stop firewalld | |
ssh $dst systemctl disable firewalld |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"log" | |
"fmt" | |
"net" | |
"bytes" | |
"unsafe" | |
"encoding/binary" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
struct stack { | |
int val; | |
struct stack *next; | |
}; | |
// find previous node function() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import sys | |
import time | |
abspath = os.path.split(os.path.realpath(__file__))[0] | |
sys.path.append("%s/lib" % abspath) | |
import redis | |
import gevent | |
from gevent import monkey; monkey.patch_all() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install ovs-dpdk | |
# Copyright Dotslash.Lu <dotslash.lu@gmail.com> | |
# | |
# NOTE: | |
# Please add `iommu=pt intel_iommu=on` to grub bootline and | |
# reboot | |
# | |
# Installation will cause NETWORK LOST, so it's better to | |
# execute this script within an admin console | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env escript | |
%% usage: find_in_dir.erl name dir[ dir2[ ...]] | |
main(P) -> | |
[For|L] = P, | |
{ok, Cwd} = file:get_cwd(), | |
Matches = flatten(lists:map(fun(Dir) -> | |
Absdir = case Dir of | |
"" -> Cwd; | |
[$/|_] -> Dir; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this won't work | |
var obj = { | |
test: function() { | |
subfunc(); | |
var subfunc = function() {}; | |
} | |
}; | |
// this one works | |
var obj = { |
NewerOlder