Skip to content

Instantly share code, notes, and snippets.

@hxy9243
hxy9243 / Dockerfile
Last active December 4, 2018 03:17
Dockerfile and scripts to make an LLVM docker image
FROM ubuntu
MAINTAINER Kevin Hu <[email protected]>
ARG LLVM_SRC=llvm-project
RUN apt-get update
RUN apt-get install -y cmake ninja-build $COMPILER
RUN apt-get build-dep -y llvm clang
RUN apt-get clean

Keybase proof

I hereby claim:

  • I am hxy9243 on github.
  • I am oldgun (https://keybase.io/oldgun) on keybase.
  • I have a public key whose fingerprint is 1FEC 53C7 6563 4A01 743D D60B D24F 1493 1403 9F1B

To claim this, I am signing this object:

@hxy9243
hxy9243 / data.cgi
Created July 27, 2015 00:00
CGI script
#!/usr/bin/env python
import cgi
import json
import time
import random
print("Content-type:text/json\n")
form = cgi.FieldStorage()
@hxy9243
hxy9243 / .emacs
Last active October 21, 2019 15:19
My Emacs Config
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Install melpa
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(when (>= emacs-major-version 24)
(require 'package)
(add-to-list
'package-archives
'("melpa" . "http://melpa.org/packages/")
t)
(package-initialize))
@hxy9243
hxy9243 / uglynumbers.py
Created January 22, 2015 03:56
Ugly Numbers
'''
Credits: This challenge has appeared in a google competition before.
Once upon a time in a strange situation, people called a number ugly if it was divisible by any of the one-digit primes (2, 3, 5 or 7). Thus, 14 is ugly, but 13 is fine. 39 is ugly, but 121 is not. Note that 0 is ugly. Also note that negative numbers can also be ugly: -14 and -39 are examples of such numbers.
One day on your free time, you are gazing at a string of digits, something like:
123456
You are amused by how many possibilities there are if you are allowed to insert plus or minus signs between the digits. For example you can make:
1 + 234 - 5 + 6 = 236
which is ugly. Or
@hxy9243
hxy9243 / Lisp_90.cpp
Last active August 29, 2015 14:11
Lisp in 90 lines
// More details on http://howtowriteaprogram.blogspot.com/2010/11/lisp-interpreter-in-90-lines-of-c.html
// Scheme Interpreter in 90 lines of C++ (not counting lines after the first 90).
// Inspired by Peter Norvig's Lis.py.
// Made by Anthony C. Hay in 2010. See http://howtowriteaprogram.blogspot.co.uk/
// This is free and unencumbered public domain software, see http://unlicense.org/
// This code is known to have faults. E.g. it leaks memory. Use at your own risk.
#include <iostream>
@hxy9243
hxy9243 / Output for globalLiveAnalysis
Created December 5, 2014 01:31
Test case for global privilege analysis
getting analysis usage
Running Split BB Pass
split on priv_raise in foo
split on priv_raise in foo
split on priv_raise in foo
split on priv_raise in bar
split on priv_raise in nothing
split on priv_lower in foo
@hxy9243
hxy9243 / .gitignore
Last active August 29, 2015 14:06
capability wrapper
a.out
out
*.txt
\#*#
~
@hxy9243
hxy9243 / Gnome_wallpaper_slideshow_gist.py
Last active October 11, 2023 03:34
Gnome Wallpaper slideshow Gist
#!/usr/bin/python
"""
For more information, see: https://help.ubuntu.com/community/SlideshowWallpapers
# 1: Create the following xml file to add wallpaper slideshow
~/.local/share/gnome-background-properties/MyFirstSlideshowCollection.xml
With the following content:
<?xml version="1.0" encoding="UTF-8"?>
@hxy9243
hxy9243 / questions
Created July 21, 2014 20:47
LLVM parser grammar specification
class ModuleParser
def initialize
@ast_prog = nil
@ast_queue = Array.new
@any_text = SeqRule.new(:line, [Any])
@ignore_rest = RepRule.new(:line, @any_text)
pri_type = AltRule.new(:line, [Literal["i64"], Literal["i32"], Literal["i8"], Literal["i1"], Literal["void"], Literal["double"], Literal["float"]])
pointers = RepRule.new(:line, SeqRule.new(:line, [Literal['*']]), [], lambda {|w| return w[0]!='*'})