Skip to content

Instantly share code, notes, and snippets.

@darcyliu
darcyliu / files.go
Last active April 7, 2024 04:01
WebDAV server in go
// go get golang.org/x/net/webdav
// go run files.go -openbrowser -http=127.0.0.1:9090
package main
import (
"context"
"flag"
"net/http"
"log"
"fmt"
@darcyliu
darcyliu / install-kubernetes-on-buster.sh
Last active March 3, 2024 22:54 — forked from BeerOnBeard/install-kubernetes-on-buster.sh
Set up a single-node Kubernetes system on Debian 10 (Bustomer). Use Flannel as the network fabric. Install the Kubernetes dashboard.
#!/bin/bash
set -e;
# Set up a single-node Kubernetes system on Debian 10 (Buster).
# Use Flannel as the network fabric. Install the Kubernetes
# dashboard.
# disable swap
swapoff -a;
@darcyliu
darcyliu / install_spark_centos7.sh
Created April 1, 2016 09:40
Install Spark on CentOS 7
#!/bin/bash
# Install Spark on CentOS 7
yum install java -y
java -version
yum install wget -y
wget http://downloads.typesafe.com/scala/2.11.7/scala-2.11.7.tgz
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
darcyliu / setup-wireguard.sh
Created December 31, 2023 08:17
Setup WireGuard on FreeBSD
pkg install -y wireguard wireguard-tools
cd /usr/local/etc/wireguard/
umask 077
wg genkey > freebsd.private
wg pubkey < freebsd.private > freebsd.public
wg genkey > client.private
wg pubkey < client.private > client.public
@darcyliu
darcyliu / gist:3063695
Created July 7, 2012 01:16
Gravator Proxy
/*
*@fileOverview gravator proxy
* reuqire node.js v0.6.7
*/
if(process.argv.length>1&&process.argv[2]=='-d'){
var HOST = '127.0.0.1';
var PORT = 1337;
}
var HOST = HOST||'0.0.0.0';
var PORT = PORT||80;
@darcyliu
darcyliu / definition.m
Created August 18, 2017 21:12
OSX dictionary definition lookup
// 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 / ClassesList.m
Created September 4, 2019 09:18
List all image names and class names
#import <objc/runtime.h>
NSArray *AllImageNames() {
unsigned int imageCount = 0;
const char **imageNames = objc_copyImageNames(&imageCount);
NSMutableArray<NSString *> *imageNameStrings = [[NSMutableArray alloc] initWithCapacity:imageCount];
if (imageNames!=NULL) {
for (unsigned int i = 0; i < imageCount; i++){
const char *imageName = imageNames[i];
NSLog(@"image name: %s", imageNames[i]);
@darcyliu
darcyliu / centos7_timechine.sh
Last active April 25, 2022 18:17
Install Time Machine service on CentOS 7
# Install Time Machine service on CentOS 7
# http://netatalk.sourceforge.net/wiki/index.php/Netatalk_3.1.7_SRPM_for_Fedora_and_CentOS
# http://confoundedtech.blogspot.com/2011/07/draft-draft-ubuntu-as-apple-time.html
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
@darcyliu
darcyliu / iOS8InternalAppIDs.txt
Created June 10, 2016 21:32
iOS8 Internal App IDs
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
@darcyliu
darcyliu / web.go
Created April 8, 2020 14:27
Go web starter
package main
import (
"net/http"
"fmt"
"log"
"flag"
"net"
"time"
"runtime"