Skip to content

Instantly share code, notes, and snippets.

View lidavidm's full-sized avatar

David Li lidavidm

View GitHub Profile
From f0fac89f20340593fdc586cf768cec69bcb20003 Mon Sep 17 00:00:00 2001
From: Alexander Polcyn <apolcyn@google.com>
Date: Thu, 31 Jan 2019 15:06:34 -0800
Subject: [PATCH] Revert "Revert c-ares as the default resolvre"
This reverts commit ca30b2240f6f8e86b51452097c3cb43c5d4f7117.
---
.../filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc | 3 ++-
templates/test/cpp/naming/resolver_component_tests_defs.include | 1 -
test/core/client_channel/resolvers/dns_resolver_test.cc | 5 ++++-
@lidavidm
lidavidm / botproxy.py
Created December 29, 2017 21:46
Halite II remote debugging
import socket
import sys
# Connect
socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
socket.bind(('localhost', int(sys.argv[1])))
socket.listen(1)
connection, _ = socket.accept()
# IO Functions
@lidavidm
lidavidm / generated.js
Created April 1, 2016 23:48
Generated Skulpt code
var $scope0 = (function($modname) {
var $gbl = {},
$blk = 0,
$exc = [],
$loc = $gbl,
$err = undefined;
$gbl.__name__ = $modname, $ret = undefined, currLineNo = undefined, currColNo = undefined;
if (typeof Sk.execStart === 'undefined') {
Sk.execStart = Date.now()
}

Keybase proof

I hereby claim:

  • I am lidavidm on github.
  • I am lidavidm (https://keybase.io/lidavidm) on keybase.
  • I have a public key whose fingerprint is A1F5 3594 0234 AEBA A56A 3243 A751 53D3 42B7 6FF1

To claim this, I am signing this object:

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lidavidm
lidavidm / rungekutta.py
Created May 22, 2013 23:21
Runge-Kutta implementation in Python + mpmath
#!/usr/bin/env python2
import mpmath
@mpmath.extradps(30)
def runge_kutta(f, t0, y0, h, steps):
t = t0
y = y0
for n in range(steps):
k1 = f(t, y)
@lidavidm
lidavidm / diffsteps.py
Last active December 15, 2015 00:09
Derivative steps using strategies module
import sympy
from sympy.strategies.core import switch
from sympy.core.function import AppliedUndef
from sympy.functions.elementary.trigonometric import TrigonometricFunction
import collections
def Rule(name, props=""):
return collections.namedtuple(name, props + " context symbol")
\startenvironment env_mocktest
% Font
\definefontfeature[default][mode=node, kern=yes, liga=yes, dlig=yes,protrusion=quality,expansion=quality]
\usemodule[simplefonts][size=11.5pt]
\setmainfont[(FONT NAME REMOVED)]
\setsansfont[(FONT NAME REMOVED)]
\setupalign[right,nothyphenated,stretch,hz,verytolerant]
% Page
//! # Basic Sample
//!
//! This sample demonstrates how to create a toplevel `window`, set its title, size and position, how to add a `button` to this `window` and how to connect signals with actions.
#![crate_type = "bin"]
extern crate gtk;
use gtk::signal::StatusIconSignals;
use gtk::traits::*;
@lidavidm
lidavidm / 16.4.16.py
Created November 27, 2012 23:37
Calculus, Chapter 16.4 problem 16
# -*- coding: utf-8 -*-
# Warning: takes FOREVER to run!
from sympy.core import Symbol, diff, pi, sympify
from sympy.integrals import integrate
from sympy.functions import sin, cos, sqrt
x, y, t = map(Symbol, 'xyt')
P = 2*x - (x**3) * (x**5)
Q = (x**3) * (y ** 8)