Skip to content

Instantly share code, notes, and snippets.

Darcy Liu darcyliu

Block or report user

Report or block darcyliu

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
# Install Spark on CentOS 7
yum install java -y
java -version
yum install wget -y
tar xvf scala-2.11.7.tgz
sudo mv scala-2.11.7 /usr/lib
sudo ln -s /usr/lib/scala-2.11.7 /usr/lib/scala
darcyliu /
Last active Jul 9, 2019
Install Time Machine service on CentOS 7
# Install Time Machine service on CentOS 7
yum install -y rpm-build gcc make wget
# install netatalk
yum install -y avahi-devel cracklib-devel dbus-devel dbus-glib-devel libacl-devel libattr-devel libdb-devel libevent-devel libgcrypt-devel krb5-devel mysql-devel openldap-devel openssl-devel pam-devel quota-devel systemtap-sdt-devel tcp_wrappers-devel libtdb-devel tracker-devel
yum install -y bison docbook-style-xsl flex dconf
View hello.cpp
// mutex example
// clang++ hello.cpp -std=c++11 -o hello
#include <iostream> // std::cout
#include <thread> // std::thread
#include <mutex> // std::mutex
std::mutex mtx; // mutex for critical section
void print_block (int n, char c) {
// critical section (exclusive access to std::cout signaled by locking mtx):
darcyliu / attribute.c
Created Jul 2, 2019
Clang constructor and destructor attributes
View attribute.c
// clang attribute.c -o attribute
#include <stdio.h>
int main(int argc, char *argv[]) {
printf("Hello World!\n");
return 0;
__attribute__((constructor)) static void beforeFunction()
darcyliu /
Created Jun 10, 2016
Samba install script for CentOS 7
# Samba install script for CentOS 7
yum install -y samba samba-client samba-common
mv /etc/samba/smb.conf /etc/samba/_smb.conf
cat >> /etc/samba/smb.conf << EOF
workgroup = WORKGROUP
server string = Samba Server %v
darcyliu /
Created Mar 31, 2016
Install mlpack on OSX 10.11 (EI Capitan)
# Install mlpack on OSX 10.11 (EI Capitan)
curl -O
tar zxvf armadillo-6.500.5.tar.gz
cd armadillo-6.500.5
make install
cd ..
View gist:1025241
<!doctype html><!-- simplified doctype works for all previous versions of HTML as well -->
<!-- Paul Irish's technique for targeting IE, modified to only target IE6, applied to the html element instead of body -->
<!--[if lt IE 7 ]><html lang="en" class="no-js ie6"><![endif]-->
<!--[if (gt IE 6)|!(IE)]><!--><html lang="en" class="no-js"><!--<![endif]-->
<!-- simplified character encoding -->
<meta charset="utf-8">
darcyliu / PriorityQueue.h
Last active Nov 6, 2018
Objective-C Priority Queue
View PriorityQueue.h
// PriorityQueue.h
// PriorityQueue
// Created by Darcy Liu on 2018/11/6.
// Copyright © 2018 Darcy Liu. All rights reserved.
#import <Foundation/Foundation.h>
darcyliu / gist:8172847
Created Dec 29, 2013
Manual Line Breaking
View gist:8172847
CGContextRef context = UIGraphicsGetCurrentContext();
// // Flip the coordinate system
// CGContextSetTextMatrix(context, CGAffineTransformIdentity);
// CGContextTranslateCTM(context, 0, self.bounds.size.height);
// CGContextScaleCTM(context, 1.0, -1.0);
UIFont *customFont = [UIFont systemFontOfSize:20];
CTFontRef font = CTFontCreateWithName((CFStringRef)customFont.fontName, 20, NULL);
darcyliu / files.go
Created Sep 17, 2018
WebDAV server in go
View files.go
// ./files -openbrowser -http=
package main
import (
You can’t perform that action at this time.