Skip to content

Instantly share code, notes, and snippets.

View celadevra's full-sized avatar

徐栖 Xuqi celadevra

View GitHub Profile
@celadevra
celadevra / mv-photos.rb
Last active March 7, 2024 14:58
Import photos to NAS, and put them into YYYY/MM folders
require 'date'
require 'exif' # in turn requires libexif
require 'fileutils'
require 'json'
SOURCE = '/Volumes/home/Drive/GDrive/Takeout/Google Photos'
DEST = '/Volumes/home/Photos/PhotoLibrary'
def main
traverse(SOURCE)
@celadevra
celadevra / fish_prompt.fish
Last active January 21, 2022 01:08
Fish shell customizations
function fish_prompt -d "Write out the prompt"
set -g last_status $status
printf '[%s@%s %s%s%s]\n(%s%s/%s%s) %s%s%s > ' $USER $hostname \
(set_color cyan) (prompt_date) (set_color normal) \
(set_color yellow) $SHLVL (prompt_status) (set_color normal) \
(set_color $fish_color_cwd) $PWD (set_color normal)
end
function prompt_date -d "Show date and time in prompt"
date "+%Y.%m.%d %H:%M"
@celadevra
celadevra / setup.sh
Last active December 8, 2019 04:02
Install software after macos installation
#!/usr/bin/env bash
# Install Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Deps
xcode-select --install
# Install stuff
brew install d12frosted/emacs-plus/emacs-plus
sudo cp -r /usr/local/opt/emacs-plus/Emacs.app /Applications/
@celadevra
celadevra / Use tramp with docker.md
Created July 31, 2017 07:36
Tramp and docker #emacs

Insert a tramp method called 'docker':

;; Open files in Docker containers like so: /docker:drunk_bardeen:/etc/passwd
(push
 (cons
  "docker"
  '((tramp-login-program "docker")
    (tramp-login-args (("exec" "-it") ("%h") ("/bin/bash")))
    (tramp-remote-shell "/bin/sh")
---
title: What are good stories according to Kurt Vonnegut
tags: writing
---
1. “Use the time of a total stranger in such a way that he or she will not feel the time was wasted.”
让读者始终对你的故事感兴趣。[How to structure your plot](https://www.standoutbooks.com/key-event-first-plot-point/?utm_source=ProWritingAid&utm_campaign=Guest%20Post)
2. “Give the reader at least one character he or she can root for.”
@celadevra
celadevra / 201704131501 第五届征文科幻主题的思考.md
Last active July 30, 2017 03:24
[第五届征文大赛] 第五届征文科幻组文案 #competition

多样性原则

鼓励乐观的基调

回归科幻的本来价值之一,使其成为一种启发和鼓舞性的类型。

我们所期望的未来是什么样子?实现它需要什么样的工作?

Tide of Tears 泪潮 by Wu Fugang 武夫刚

In the near future, AI-powered ads study you, know you, and then destroy you.

Tide of Tears, a sophisticated machine learning algorithm, creates perfect user profiles, and generates advertisements that always lead to purchase behavior. It saves a dwindling economy, but once happy and healthy people begin to die from the extreme sadness that ToT digs out from the deep of their minds. The only one standing between domination of the algorithm and the devastated Mankind, is a depressed woman.

@celadevra
celadevra / 201707241450 貔貅 app 首页推荐语.md
Created July 30, 2017 03:08
作品推荐文案 #douban #promotion

人造生命“貔貅”,给年轻的生物工程师出了难题。他没有意识到,要理解这种生命,他得先理解自己和祖辈。

@celadevra
celadevra / Dockerfile
Last active January 29, 2016 04:44
My config and dockerfiles for automated blog update on digitalocean
FROM nginx
COPY config /etc/nginx/nginx.conf
COPY privkey.pem /etc/nginx/privkey.pem # these are certificates obtained from Let's Encrypt
COPY chain.pem /etc/nginx/chain.pem
COPY fullchain.pem /etc/nginx/fullchain.pem
@celadevra
celadevra / net.expoundite.duplicity.plist
Created January 27, 2016 06:13
duplicity-backup launch agent plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>net.expoundite.duplicity</string>
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin</string>