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
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
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()
{
printf("beforeFunction\n");
@darcyliu
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
darcyliu / files.go
Created Sep 17, 2018
WebDAV server in go
View files.go
// ./files -openbrowser -http=127.0.0.1:9090
package main
import (
"context"
"flag"
"net/http"
"log"
"fmt"
"net"
@darcyliu
darcyliu / clinfo.m
Created Aug 28, 2017
Retrieve OpenCL Information on OSX
View clinfo.m
//
// clinfo.m
// clinfo
//
// Created by Darcy Liu on 26/08/2017.
// Copyright © 2017 Darcy Liu. All rights reserved.
//
// clang -fobjc-arc -fmodules clinfo.m -o clinfo
@darcyliu
darcyliu / definition.m
Created Aug 18, 2017
OSX dictionary definition lookup
View definition.m
// Command-line dictionary lookup.
//
// Build with:
// clang -framework CoreServices
// clang -fobjc-arc -fmodules definition.m -o definition
#import <CoreFoundation/CoreFoundation.h>
#import <CoreServices/CoreServices.h>
@darcyliu
darcyliu / proxy.js
Created May 10, 2017
Simple HTTP Proxy
View proxy.js
var http = require('http');
var net = require('net');
var url = require('url');
function onRequest(request, response) {
console.log('request: ' + request.url);
var u = url.parse(request.url);
var options = {
hostname: u.hostname,
@darcyliu
darcyliu / openimages_dataset_downloader.py
Created Nov 16, 2016
openimages dataset downloader
View openimages_dataset_downloader.py
#!/usr/bin/env python
# encoding: utf-8
"""
openimages_dataset_downloader.py
Created by Darcy on 15/11/2016.
Copyright (c) 2016 Darcy. All rights reserved.
"""
import argparse
@darcyliu
darcyliu / centos7_samba.sh
Created Jun 10, 2016
Samba install script for CentOS 7
View centos7_samba.sh
#!/bin/sh
# 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
[global]
workgroup = WORKGROUP
server string = Samba Server %v
View iOS8InternalAppIDs.txt
com.apple.SharedWebCredentialViewService
com.apple.FacebookAccountMigrationDialog
com.apple.mobilesafari
com.apple.AdSheetPhone
com.apple.share
com.apple.appleaccount.AACredentialRecoveryDialog
com.apple.Preferences
com.apple.WebContentFilter.remoteUI.WebContentAnalysisUI
com.apple.Passbook
com.apple.TrustMe
You can’t perform that action at this time.