Skip to content

Instantly share code, notes, and snippets.

View yuxincs's full-sized avatar
💡
Ideas survive in your memory, implementations do not.

Yuxin Wang yuxincs

💡
Ideas survive in your memory, implementations do not.
  • Uber
  • New York City
  • 06:52 (UTC -04:00)
View GitHub Profile
#!/usr/bin/env bash
# Exit on error
set -e
# Ensure script is running as root
if [ "$EUID" -ne 0 ]
then echo "WARN: Please run as root (sudo)"
exit 1
fi
@yuxincs
yuxincs / portable_get_mac_addresses.c
Last active June 5, 2018 17:39 — forked from nuald/listmacaddrs.c
Getting MAC addresses
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <ifaddrs.h>
// works on Linux and macOS
#ifdef AF_LINK
#include <net/if_dl.h>
unsigned char *get_ptr(struct ifaddrs *ifaptr)
{
@yuxincs
yuxincs / Install oh-my-zsh on OpenWRT.md
Last active September 27, 2017 19:53 — forked from fire1ce/oh-my-zsh on openwrt or lede-project.md
Install oh-my-zsh on openwrt/lede-project
opkg update && opkg install ca-certificates zsh curl git-http
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" 

Edit /etc/passwd and change root:x:0:0:root:/root:/bin/ash to root\\:x:0:0:root:/root:/bin/zsh

Reboot, all done.