Skip to content

Instantly share code, notes, and snippets.

View harrifeng's full-sized avatar

Harri Feng harrifeng

View GitHub Profile
@harrifeng
harrifeng / rm_docker_mac.sh
Created August 8, 2017 07:29
remove everything about docker from mac
#!/bin/bash
# Copyright 2017 Théo Chamley
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in the Software
# without restriction, including without limitation the rights to use, copy, modify, merge,
# publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
# to whom the Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all copies or
@harrifeng
harrifeng / python-igraph-binary-tree-print-root-at-top.py
Created August 2, 2017 06:58
Create image from python-igraph while keep the root at the top
from igraph import *
g = Graph.Tree(7, 2)
layout = g.layout_reingold_tilford(mode="in", root=[0])
g.vs['size'] = ['60']
g.vs['color'] = ['green', 'red', 'blue', 'yellow']
g.vs['label'] = ['Alice', 'Bob', 'Claire', 'Dennis', 'Esther', 'Frank', 'George', 'Harry']
g.write_svg('first.svg', layout=layout, vertex_size=20)
plot(g, layout=layout,bbox = (500, 300), margin = 50)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@harrifeng
harrifeng / reverse_list.c
Created June 9, 2017 05:54
Revere a linked list
//单链表的转置,循环方法
Node* reverseByLoop(Node *head)
{
if(head == NULL || head->next == NULL)
return head;
Node *pre = NULL;
Node *next = NULL;
while(head != NULL)
{
next = head->next;
@harrifeng
harrifeng / centos-packstack.sh
Created May 26, 2017 05:44
All-in-one quickstart: Proof of concept for single node
yum install -y centos-release-openstack-ocata
yum update -y
yum install -y openstack-packstack
packstack --allinone

Either you use .babelrc to specify environment specific settings (plugins or transforms for example) using the env key:

{
  "presets": ["es2015", "stage-0", "react"],
  "env": {
    "development": {
      "plugins": [
        ["transform-object-rest-spread"],
 ["transform-react-display-name"],
@harrifeng
harrifeng / gist:e3f24a0f6052fed03b91538a07c234a2
Created March 23, 2017 06:25 — forked from toddmotto/gist:6596373
Disable Web Security in Chrome Canary to make cross-domain XHR requests (local servers obvs).
open -a Google\ Chrome\ Canary --args --disable-web-security
@harrifeng
harrifeng / ssl_puma.sh
Created March 20, 2017 06:31 — forked from tadast/ssl_puma.sh
localhost SSL with puma
# 1) Create your private key (any password will do, we remove it below)
$ cd ~/.ssh
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
} else {
// If a string is acceptable according to the format, see if
// the value satisfies one of the string-valued interfaces.
// Println etc. set verb to %v, which is "stringable".
switch verb {
case 'v', 's', 'x', 'X', 'q':
// Is it an error or Stringer?
// The duplication in the bodies is necessary:
// setting handled and deferring catchPanic
// must happen before calling the method.
You probably won't need to do this often (if ever at all) but just in case, here is how to delete a tag from a remote Git repository.
If you have a tag named '12345' then you would just do this:
git tag -d 12345
git push origin :refs/tags/12345
That will remove '12345' from the remote repository.