Skip to content

Instantly share code, notes, and snippets.

View lostsnow's full-sized avatar
👻
nil

lostsnow lostsnow

👻
nil
  • Litsea
  • Phobos, Mars
View GitHub Profile
@lostsnow
lostsnow / mkdir.yml
Created October 4, 2020 08:45
Ansible mkdir playbook
---
- name: mkdir
hosts: node_exporters
tasks:
- name: set ubuntu user name
set_fact: sys_user=ubuntu
when: ansible_distribution == 'Ubuntu'
- name: set centos user name
set_fact: sys_user=centos
@lostsnow
lostsnow / authorized_key.yml
Last active October 4, 2020 08:39
Ansible authorized_key playbook
---
- name: authorized_key
hosts: node_exporters
tasks:
- name: set ubuntu user name
set_fact: sys_user=ubuntu
when: ansible_distribution == 'Ubuntu'
- name: set centos user name
set_fact: sys_user=centos
#!/bin/bash
set -e
# 基础
# export JAVA_HOME=/work/programs/jdk/jdk1.8.0_181
# export PATH=PATH=$PATH:$JAVA_HOME/bin
# export CLASSPATH=$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
DATE=$(date +%Y%m%d%H%M)
# 基础路径
let sessionId;
async function waitOnSign() {
return new Promise(resolve => {
let chk = setInterval(() => {
if (sessionId) {
clearInterval(chk)
resolve(sessionId)
}
}, 100);
});
@lostsnow
lostsnow / docker-compose.yml
Last active April 3, 2020 02:55
docker compose for mysql 5.7
version: '3.3'
services:
db:
image: mysql:5.7
restart: always
environment:
MYSQL_DATABASE: 'planet'
# So you don't have to use root, but you can if you like
#include <ansi.h>
# https://www.zuggsoft.com/zmud/mxp.htm
#define MXP_OPEN_TAG CSI"0z"
#define MXP_SEC_TAG CSI"1z"
#define MXP_LOCK_TAG CSI"2z"
#define MXP_RESET_TAG CSI"3z"
#define MXP_LSEC_TAG CSI"6z"
// ==UserScript==
// @id com.iitcplugins.autorefresh
// @name IITC plugin: Auto-refresh Map
// @category Misc
// @version 1.3.2.1
// @namespace https://iitcplugins.com/
// @description Automatically refreshes map data every 60 seconds. To change time, modify the window.plugin.autoRefresh.timeout in milliseconds you wish to use. (20000 is 20 seconds)
// @include https://*.ingress.com/intel*
// @include http://*.ingress.com/intel*
// @match https://*.ingress.com/intel*
int sort(mapping a, mapping b)
{
return a["value"] - b["value"];
}
int main(object me, string arg)
{
mapping m = (["a": 2, "b": 3, "c": 1]);
mapping *a, *b;
mixed *mk;
@lostsnow
lostsnow / mysql-backup-all.sh
Created December 25, 2018 01:54
Backup all mysql data
#!/bin/bash
MYSQL_HOST=127.0.0.1
MYSQL_USER=root
MYSQL_PASS='123456'
MYSQL_CONN="-h${MYSQL_HOST} -u${MYSQL_USER} -p${MYSQL_PASS}"
#
# Collect all database names except for
# mysql, information_schema, and performance_schema
#
@lostsnow
lostsnow / purge2.sh
Created December 7, 2018 12:11 — forked from carlessanagustin/purge2.sh
Script to reduce VM size before packaging for Vagrant v.2
#!/bin/sh
# Credits to:
# - http://vstone.eu/reducing-vagrant-box-size/
# - https://github.com/mitchellh/vagrant/issues/343
# - https://gist.github.com/adrienbrault/3775253
## for vagrant related tasks, uncomment vagrant comments
# vagrant: Unmount project