Skip to content

Instantly share code, notes, and snippets.

View hustlijian's full-sized avatar
🎯
Focusing

Li Jian hustlijian

🎯
Focusing
View GitHub Profile
@hustlijian
hustlijian / ycm_extra_conf.py for libevent
Created February 28, 2020 07:18
YCM config to FindCorrespondingSourceFile from upper directory (eg:libevent)
def FindCorrespondingSourceFile( filename ):
if IsHeaderFile( filename ):
basename = os.path.splitext( filename )[ 0 ]
for extension in SOURCE_EXTENSIONS:
replacement_file = basename + extension
if os.path.exists( replacement_file ):
return replacement_file
name = os.path.basename(replacement_file)
upper_file = os.path.normpath(os.path.join(os.path.dirname(replacement_file), "../", name))
if os.path.exists( upper_file):
#!/bin/bash
###
### my-script — does one thing well
###
### Usage:
### my-script <input> <output>
###
### Options:
### <input> Input file to read.
### <output> Output file to write. Use '-' for stdout.
@hustlijian
hustlijian / get_mac.cpp
Created December 22, 2020 11:59
get mac by cpp
#include <stdio.h> //printf
#include <string.h> //strncpy
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <net/if.h> //ifreq
#include <unistd.h> //close
int main()
{
int fd;