Skip to content

Instantly share code, notes, and snippets.

View xiaoruiguo's full-sized avatar

xiaoruiguo xiaoruiguo

View GitHub Profile
@xiaoruiguo
xiaoruiguo / lxc-start.sh
Created September 8, 2022 10:58 — forked from lcherone/lxc-start.sh
LXD Start all stopped containers
#!/bin/bash
#
# Start all stopped containers
#
# stop running containers
for container in $(lxc list volatile.last_state.power=STOPPED -c n --format csv); do
lxc start "$container"
done
@xiaoruiguo
xiaoruiguo / shiro.ini
Created May 2, 2022 23:13 — forked from adamjshook/shiro.ini
Apache Shiro JdbcRealm MySQL Example
# Apache Shiro v1.2.3
# Install MySQL
# $ sudo yum install mysql-server
# $ sudo /sbin/service mysqld start
# $ sudo chkconfig mysqld on
# Secure install and set root password
# $ sudo /usr/bin/mysql_secure_installation
@xiaoruiguo
xiaoruiguo / LXC Cache
Created March 27, 2022 05:03 — forked from ankita-anil-verma/LXC Cache
on exe (openstack-ansible setup-hosts.yml --limit infra3)of setup host infra 3 fails at task ENSURE LXC CACHE HAS BEEN PREPARED
FAILED - RETRYING: Ensure that the LXC cache has been prepared (1 retries left).
fatal: [infra3]: FAILED! => {"ansible_job_id": "766365788508.23851", "attempts": 60, "changed": false, "failed": true, "finished": 0, "started": 1}
NO MORE HOSTS LEFT ***************************************************************************************************
NO MORE HOSTS LEFT ***************************************************************************************************
PLAY RECAP ***********************************************************************************************************
infra3 : ok=202 changed=80 unreachable=0 failed=1
@xiaoruiguo
xiaoruiguo / inventory2json.py
Created January 9, 2022 07:36 — forked from sivel/inventory2json.py
Ansible inventory to dynamic inventory JSON output, accepts all inventory input formats
import sys
import json
from ansible.parsing.dataloader import DataLoader
try:
from ansible.inventory.manager import InventoryManager
A24 = True
except ImportError:
from ansible.vars import VariableManager
@xiaoruiguo
xiaoruiguo / useApi.ts
Created August 31, 2021 08:47 — forked from mortezasabihi/useApi.ts
Vue 3 axios composition api
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
import { reactive, toRefs } from 'vue';
import axios,{ AxiosRequestConfig, AxiosError, AxiosResponse } from 'axios';
export enum Status {
IDLE = 'idle',
LOADING = 'loading',
SUCCESS = 'success',
ERROR = 'error',
@xiaoruiguo
xiaoruiguo / _src_modules_auth_store_index.ts
Created August 27, 2021 00:50 — forked from soerenmartius/_src_modules_auth_store_index.ts
Vue 3 with Typescriptt and Vuex 4 Typed Modules Examples ( with real types )
import {
ActionContext,
ActionTree,
GetterTree,
MutationTree,
Module,
Store as VuexStore,
CommitOptions,
DispatchOptions,
} from 'vuex'
@xiaoruiguo
xiaoruiguo / auth.ts
Created August 26, 2021 09:20 — forked from AndreaMinato/auth.ts
Typescript Vuex Module
import axios, { AxiosRequestConfig } from "axios";
import router from "@/router"; //shortcut to src
import { Module } from "vuex";
const authModule: Module<any, any> = {
state: {
loggedIn: false,
loginError: null,
username: null
@xiaoruiguo
xiaoruiguo / Vagrantfile
Created August 26, 2021 08:12 — forked from jgarber/Vagrantfile
CloudStack simulator
Vagrant.configure("2") do |config|
config.vm.box = "cloudstack-simulator"
config.vm.box_url = "https://dl.dropboxusercontent.com/u/4153969/PromptWorks/cloudstack-simulator.box"
config.vm.network "private_network", ip: "10.0.123.101"
config.vm.provider "virtualbox" do |vbox|
vbox.memory = 2048
end
end
@xiaoruiguo
xiaoruiguo / Window-Atom-Tricks.md
Created June 21, 2021 15:27 — forked from tdonohue/Window-Atom-Tricks.md
Windows + Atom + Vagrant tricks

Editing files in Vagrant using your local copy of Atom

In case you want to have an IDE locally, but have your Development environment be on a VM

  1. Install Atom on your local (host) machine: https://atom.io/
  2. Install the "remote-sync" package: https://atom.io/packages/remote-sync
  3. Ensure Vagrant is running (e.g. vagrant up)
  4. Create an empty directory on your local (host) machine that you want to "sync" with a directory on the Vagrant VM
  5. Open that empty directory in Atom
  6. Right click on it, select "Remote Sync -> Configure"
@xiaoruiguo
xiaoruiguo / update-golang.md
Created June 13, 2021 05:20 — forked from nikhita/update-golang.md
How to update the Go version

How to update the Go version

System: Debian/Ubuntu/Fedora. Might work for others as well.

1. Uninstall the exisiting version

As mentioned here, to update a go version you will first need to uninstall the original version.

To uninstall, delete the /usr/local/go directory by: