This file contains hidden or 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 asyncio | |
import argparse | |
import logging | |
import json | |
from copy import copy | |
from typing import Optional, Iterable | |
logger = logging.getLogger(__name__) | |
# optional setup for optimizations |
This file contains hidden or 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
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target / |
This file contains hidden or 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
wget https://releases.llvm.org/3.4.2/llvm-3.4.2.src.tar.gz | |
tar -xzf llvm-3.4.2.src.tar.gz | |
cd llvm-3.4.2.src | |
# comment out memory sanitizer checks | |
# see https://stackoverflow.com/questions/48188796/clang-4-0-fails-to-build-clang-3-42-on-ubuntu-17-04 | |
sed -i '' -e 's/__msan_unpoison/\/\/__msan_unpoison/' ./lib/Target/X86/X86JITInfo.cpp | |
sed -i '' -e 's/__msan_allocated_memory/\/\/__msan_allocated_memory/' lib/Support/Allocator.cpp | |
sed -i '' -e 's/__msan_unpoison/\/\/__msan_unpoison/' lib/Support/Compression.cpp | |
mkdir build && cd build && cmake .. |
This file contains hidden or 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 argparse | |
import os | |
import re | |
import logging | |
import shutil | |
logging.basicConfig(format='%(levelname)s: %(message)s') | |
_comment = re.compile(r'\\begin\{comment\}[\s\S]*\\end{comment}|(?<!\\)%.*\n') | |
_empty_line = re.compile(r'\n\s*\n') |
This file contains hidden or 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 json | |
import os | |
def json2sql(json_path, sql_path, table_name, encoding='utf-8', is_multi_line=False): | |
# read the data | |
data = [] | |
with open(json_path, 'r', encoding=encoding) as f: | |
if is_multi_line: | |
for line in f: |
This file contains hidden or 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 matplotlib.pyplot as plt | |
plt.rc('text', usetex=True) | |
plt.rc('font', family='serif') |
This file contains hidden or 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 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 |
This file contains hidden or 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 <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) | |
{ |
This file contains hidden or 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
ln -s $(which git) /usr/lib/git-core/git |
This file contains hidden or 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
# Generate your identity key on openwrt | |
dropbearkey -t rsa -f ~/.ssh/id_rsa | |
# Convert public key from dropbear binary to openssh text | |
# Copy and paste output from below to bitbucket account ssh keys | |
dropbearkey -y -f ~/.ssh/id_rsa | head -n 2 | tail -1 | |
# Change git ssh command | |
echo "#!/bin/sh" > ~/.gitssh.sh | |
echo "dbclient -y -i ~/.ssh/id_rsa \$\*" >> ~/.gitssh.sh |
NewerOlder