Skip to content

Instantly share code, notes, and snippets.

@xudifsd
xudifsd / pdbdump.c
Created March 7, 2023 21:03 — forked from mridgers/pdbdump.c
Small tool to list and query symbols in PDB files.
//------------------------------------------------------------------------------
// pdbdump.c - dump symbols from .pdb and executable files (public domain).
// - to compile; cl.exe /Ox /Zi pdbdump.c
// -
// - Martin Ridgers, pdbdump 'at' fireproofgravy.co.uk
//------------------------------------------------------------------------------
#include <stdio.h>
#include <Windows.h>
#include <DbgHelp.h>
@xudifsd
xudifsd / cv.tex
Created August 9, 2022 17:49
use `xelatex cv.tex` to build
%# -*- coding:utf-8 -*-
\documentclass[11pt,a4paper]{moderncv}
\usepackage{fontspec,xunicode}
%\usepackage[slantfont,boldfont]{xeCJK}
\usepackage{xcolor} % replace by the encoding you are using
%\defaultfontfeatures{Mapping=tex-text}
%\XeTeXlinebreaklocale "zh"
%\XeTeXlinebreakskip = 0pt plus 1pt minus 0.1pt
#!/usr/bin/env python
# Sat 21 Nov 2020 10:12:23 PM PST
def permutation(lst):
assert len(lst) > 0
result = []
def helper():
if len(lst) == 0:
yield result[:]
from __future__ import print_function
import numpy as np
import tensorflow as tf
import time
# Import MNIST data
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("/tmp/data/", one_hot=True)
@xudifsd
xudifsd / ImmutableMap.java
Created January 24, 2018 03:58
I often found myself thinking in clojure's PersistentHashMap, this data structure is indeed marvel. I also often need this data structure in some project, and have to include the whole clojure.jar in project even if I didn't need any other functionality provided by clojure. So I clean some unnecessary code of PersistentHashMap from clojure and a…
/**
* Copyright (c) Rich Hickey. All rights reserved.
* The use and distribution terms for this software are covered by the
* Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
* which can be found in the file epl-v10.html at the root of this distribution.
* By using this software in any fashion, you are agreeing to be bound by
* the terms of this license.
* You must not remove this notice, or any other, from this software.
**/
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import traceback
import sqlite3
import logging
from Queue import Queue
from Queue import Empty
@xudifsd
xudifsd / tree.rs
Last active April 10, 2016 06:30
rust implementation of binary tree insertion
pub struct Tree<T> {
root: Link<T>,
size: usize,
}
type Link<T> = Option<Box<Node<T>>>;
struct Node<T> {
elem: T,
left: Link<T>,
struct ListNode<'a, T> where T: PartialOrd + 'a {
val: &'a T,
next: Option<Box<ListNode<'a, T>>>,
}
fn reverse_list<'a, T>(head: Option<Box<ListNode<'a, T>>>) -> Option<Box<ListNode<'a, T>>>
where T: 'a + PartialOrd {
if let Some(mut p) = head {
let mut tail = None;
loop {
#!/usr/bin/env python
class TreeNode:
def __init__(self, val):
self.val = val
self.left = None
self.right = None
def printTreeWithDistance(root, k):
def impl(root, path):
@xudifsd
xudifsd / Main.java
Last active September 30, 2015 04:30
Fibonacci
/*
时间限制:10000ms
单点时限:1000ms
内存限制:256MB
描述
Given a sequence {an}, how many non-empty sub-sequence of it is a prefix of fibonacci sequence.
A sub-sequence is a sequence that can be derived from another sequence by deleting some elements without changing the order of the remaining elements.
The fibonacci sequence is defined as below: