Skip to content

Instantly share code, notes, and snippets.

View dariaphoebe's full-sized avatar

Daria Phoebe Brashear dariaphoebe

View GitHub Profile
//
// CLLocation+Sino.h
//
// Created by i0xbean@gmail.com on 13-4-26.
// 火星坐标系转换扩展
//
// earth(国外 WGS84), mars(国内 GCJ-02), bearPaw(百度 BD-09) 坐标系间相互转换
// 未包含 mars2earth. 需要这个可参考 http://xcodev.com/131.html
#import <CoreLocation/CoreLocation.h>
@dariaphoebe
dariaphoebe / dockelly
Last active August 29, 2015 14:07 — forked from nyarla/dockelly
#!/usr/bin/env bash
address=192.168.20.129
running=`echo -n $(nmap ${address} -p 4243) | grep 'close' | grep '4243/tcp'`
if [ ! -z "${running}" ]; then
ssh docker@${address} <<EOF
sudo /usr/local/etc/init.d/docker stop
sudo sh -c "/usr/local/bin/docker -H tcp://${address}:4243 -d > /var/lib/docker/docker.log 2>&1 &"
@dariaphoebe
dariaphoebe / twitter_unfollow.rb
Created March 17, 2016 05:56 — forked from coilysiren/config.yaml
Unfollows: (a) people who dont follow you back (b) people you haven't talked to (c) people who haven't posted in a month
require 'twitter' # gem install twitter
require 'capybara' # gem install capybara
require 'capybara/dsl'
# CONFIGS
exceptions = [
'XXXXXXXX',
import graphviz
import pkg_resources
pkg_keys = {}
for item in pkg_resources.working_set:
r = item.as_requirement()
pkg_keys[r.key] = r.project_name
depends = {}
for item in pkg_resources.working_set:
depends[item.as_requirement().key] = [r.key for r in item.requires()]
@dariaphoebe
dariaphoebe / highsierra_bootable.sh
Created August 11, 2017 18:13 — forked from agentsim/highsierra_bootable.sh
Create bootable ISO from HighSierra Installer
# Generate a BaseSystem.dmg with 10.13 Install Packages
hdiutil attach /Applications/Install\ macOS\ 10.13\ Beta.app/Contents/SharedSupport/InstallESD.dmg -noverify -mountpoint /Volumes/highsierra
hdiutil create -o /tmp/HighSierraBase.cdr -size 7316m -layout SPUD -fs HFS+J
hdiutil attach /tmp/HighSierraBase.cdr.dmg -noverify -mountpoint /Volumes/install_build
asr restore -source /Applications/Install\ macOS\ 10.13\ Beta.app/Contents/SharedSupport/BaseSystem.dmg -target /Volumes/install_build -noprompt -noverify -erase
cp -R /Volumes/highsierra/Packages /Volumes/OS\ X\ Base\ System/System/Installation
hdiutil detach /Volumes/OS\ X\ Base\ System/
hdiutil detach /Volumes/highsierra/
mv /tmp/HighSierraBase.cdr.dmg /tmp/BaseSystem.dmg
@dariaphoebe
dariaphoebe / virt-addr.sh
Created August 18, 2017 20:07 — forked from tensorfields/virt-addr.sh
Get a KVM guest's IP address
#!/bin/bash
# Returns the IP address of a running KVM guest VM
# Assumes a working KVM/libvirt environment
#
# Install:
# Add this bash function to your ~/.bashrc and `source ~/.bashrc`.
# Usage:
# $ virt-addr vm-name
# 192.0.2.16
#
@dariaphoebe
dariaphoebe / global.R
Created August 28, 2017 04:12 — forked from andland/global.R
CD102.5 Top Songs by Artist in 2013
library(XML)
library(lubridate)
library(sqldf)
library(reshape2)
library(ggplot2)
library(mgcv)
cat("loading old data...\n")
playlist=read.csv("CD101Playlist.csv",stringsAsFactors=FALSE)
colnames(playlist)[3]="Last Played"
@dariaphoebe
dariaphoebe / key.md
Created April 9, 2019 00:27 — forked from sokcuri/key.md
Twitter (un)official Consumer Key

Twitter Official Consumer Key

Twitter for Android

type:            PIN
Consumer key:    3nVuSoBZnx6U4vzUxf5w
Consumer secret: Bcs59EFbbsdF6Sl9Ng71smgStWEGwXXKSjYvPVt7qys

Twitter for iPhone

type:            PIN

Consumer key: IQKbtAYlXLripLGPWd0HUA

@dariaphoebe
dariaphoebe / libdispatch-efficiency-tips.md
Created February 8, 2022 17:46 — forked from tclementdev/libdispatch-efficiency-tips.md
Making efficient use of the libdispatch (GCD)

libdispatch efficiency tips

The libdispatch is one of the most misused API due to the way it was presented to us when it was introduced and for many years after that, and due to the confusing documentation and API. This page is a compilation of important things to know if you're going to use this library. Many references are available at the end of this document pointing to comments from Apple's very own libdispatch maintainer (Pierre Habouzit).

My take-aways are:

  • You should create very few, long-lived, well-defined queues. These queues should be seen as execution contexts in your program (gui, background work, ...) that benefit from executing in parallel. An important thing to note is that if these queues are all active at once, you will get as many threads running. In most apps, you probably do not need to create more than 3 or 4 queues.

  • Go serial first, and as you find performance bottle necks, measure why, and if concurrency helps, apply with care, always validating under system pressure. Reuse

@dariaphoebe
dariaphoebe / ThirdPartyKexts.md
Created October 10, 2023 19:53 — forked from steven-michaud/ThirdPartyKexts.md
Running Third Party Kernel Extensions on Virtualization Framework macOS Guest VMs

Running Third Party Kernel Extensions on Virtualization Framework macOS Guest VMs

As of macOS 12 (Monterey), Apple's Virtualization framework has nice support for macOS guest virtual machines, but with severe limitations: For example you can't install a macOS guest on Intel Macs, install guests with newer versions of macOS than the host, copy and paste between the host and the guest, or install third party kernel extensions in the guest. As usual for Apple, the functionality they do support is nicely implemented, but they've left out so much that the result is only marginally useful -- at least compared to