Skip to content

Instantly share code, notes, and snippets.

View southwolf's full-sized avatar

SouthWolf southwolf

  • Amplifyhealth
  • Hong Kong
View GitHub Profile
@southwolf
southwolf / az_vm.tf
Created December 21, 2019 04:24
Create azure vm
provider "azurerm" {
version = "=1.38.0"
subscription_id = "91e51453-1db3-46d0-8329-423542539317"
}
# Create a resource group
resource "azurerm_resource_group" "rg" {
name = "tf_resource_group"
location = "westus2"
@southwolf
southwolf / stats.js
Created January 21, 2019 03:14 — forked from izaac/stats.js
An example statistics library in Javascript.
#!/usr/bin/env node
/* jshint node: true */
'use strict';
var program = require('commander');
function add(a, b){
return a + b;
}
function numericSort(a,b) {
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
annotations:
pv.kubernetes.io/bind-completed: "yes"
pv.kubernetes.io/bound-by-controller: "yes"
volume.beta.kubernetes.io/storage-provisioner: kubernetes.io/aws-ebs
labels:
app: mongodb
chart: mongodb-3.0.4
@southwolf
southwolf / main.go
Created May 7, 2018 14:45 — forked from enricofoltran/main.go
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
@southwolf
southwolf / eventmachine.rb
Created September 16, 2017 14:21 — forked from marianposaceanu/eventmachine.rb
Initializer that allows EventMachine to run within Rails, and work with AMQP, Passenger, Thin and Capybara
require 'amqp'
module HiringThingEM
def self.start
if defined?(PhusionPassenger)
PhusionPassenger.on_event(:starting_worker_process) do |forked|
# for passenger, we need to avoid orphaned threads
if forked && EM.reactor_running?
EM.stop
end
Thread.new {
project :test => :shoulda, :renderer => :haml, :stylesheet => :sass, :script => :jquery, :orm => :activerecord
#default routes
APP_INIT = <<-APP
get "/" do
"Hello World!"
end
get :about, :map => '/about_us' do
render :haml, "%p This is a sample blog created to demonstrate the power of Padrino!"
project :test => :shoulda, :renderer => :haml, :stylesheet => :sass, :script => :jquery, :orm => :activerecord
#default routes
APP_INIT = <<-APP
get "/" do
"Hello World!"
end
get :about, :map => '/about_us' do
render :haml, "%p This is a sample blog created to demonstrate the power of Padrino!"
@southwolf
southwolf / post.rb
Created March 26, 2017 12:06
Ruby will crash when forgetting to append `result` after `ransack()`
class Post < ActiveRecord::Base
end

近来由于 Mac 出了点小问题一直没有解决,加上用了已经有好长一段时间,一直想清理一下(精神洁癖作祟),所幸重装了事。没有使用 TimeMachine,所以需要先行将一些觉得尚有价值的文件拷贝下来。

写下这篇文章,也是为了以后再次遇到问题能够有章可循,不至于胡乱一通重装。本文也会持续更新,欢迎大家分享更好的使用技巧与经验。

重装 macOS

在线恢复系统实在太慢,进行在 Windows 下制作 Mac U盘启动盘重装系统. 额外所需的物理设备为 U 盘一个,8G 及以上为宜。

1. 准备软件与镜像

@southwolf
southwolf / tumblr-photo-ripper.rb
Created November 2, 2015 02:50 — forked from jamiew/tumblr-photo-ripper.rb
Download all the images from a Tumblr blog
# Usage:
# [sudo] gem install mechanize
# ruby tumblr-photo-ripper.rb
require 'rubygems'
require 'mechanize'
# Your Tumblr subdomain, e.g. "jamiew" for "jamiew.tumblr.com"
site = "doctorwho"