Skip to content

Instantly share code, notes, and snippets.

@lizhiyong2000
lizhiyong2000 / cas-get.sh
Created October 16, 2019 05:37
curl cas server login
# Usage: cas-get.sh {url} {username} {password} # If you have any errors try removing the redirects to get more information
# The service to be called, and a url-encoded version (the url encoding isn't perfect, if you're encoding complex stuff you may wish to replace with a different method)
DEST="$1"
ENCODED_DEST=`echo "$DEST" | perl -p -e 's/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg' | sed 's/%2E/./g' | sed 's/%0A//g'`
echo $ENCODED_DEST
#IP Addresses or hostnames are fine here
CAS_HOSTNAME=cas.test.com:9000
#Authentication details. This script only supports username/password login, but curl can handle certificate login if required
USERNAME=test
@lizhiyong2000
lizhiyong2000 / CentOS-7.repo
Created October 9, 2019 06:49
NGINX代理yum源
[base]
name=CentOS-$releasever - Base - mirror.global.com
failovermethod=priority
baseurl=http://mirror.global.com:8081/centos/$releasever/os/$basearch/
http://mirror.global.com:8081/centos/$releasever/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
gpgcheck=1
gpgkey=http://mirror.global.com:8081/centos/RPM-GPG-KEY-CentOS-7
#released updates
@lizhiyong2000
lizhiyong2000 / mount_disk.sh
Created October 9, 2019 06:46
磁盘挂载脚本
#!/bin/bash
# An set of disks to ignore from partitioning and formatting
BLACKLIST="sdm"
# Base directory to hold the data* files
DATA_BASE="/mnt"
usage() {
echo "Usage: $(basename $0) <new disk>"
}
@lizhiyong2000
lizhiyong2000 / App.js
Created June 8, 2019 10:09 — forked from rogeliog/App.js
Composition and filters in React
/*
This is a minimal working example
*/
import React, { Component } from 'react';
import Filters from './Filters';
import InputFilter from './InputFilter';
import allMovies from './movies';
class App extends Component {
@lizhiyong2000
lizhiyong2000 / GIF-Screencast-OSX.md
Created May 18, 2019 09:22 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@lizhiyong2000
lizhiyong2000 / get_python_sitepackages.py
Last active May 14, 2019 06:07
get python sitepackages locations
import subprocess
import json
def get_python_sitepackages():
cmd = 'python3 -c "import site; print(site.getsitepackages())"'
s = subprocess.Popen(cmd, stdout=subprocess.PIPE, stdin=subprocess.PIPE, shell=True)
out = s.stdout.read().decode("utf-8")
s.stdout.close()