Skip to content

Instantly share code, notes, and snippets.

View liupeng0518's full-sized avatar
🎯
Focusing

Samuel Liu liupeng0518

🎯
Focusing
View GitHub Profile
@liupeng0518
liupeng0518 / mysql_index_migration_procs.sql
Created December 29, 2023 07:28 — forked from JonLatane/mysql_index_migration_procs.sql
MYSQL stored procedures for "Drop Index If Exists" and "Create Or Update Index"
DELIMITER $$
DROP PROCEDURE IF EXISTS drop_index_if_exists $$
CREATE PROCEDURE drop_index_if_exists(in theIndexName varchar(128), in theTable varchar(128))
BEGIN
IF((SELECT COUNT(*) AS index_exists FROM information_schema.statistics WHERE TABLE_SCHEMA = DATABASE() and table_name =
theTable AND index_name = theIndexName) > 0) THEN
SET @s = CONCAT('DROP INDEX `' , theIndexName , '` ON `' , theTable, '`');
PREPARE stmt FROM @s;
EXECUTE stmt;
END IF;
git config --global https.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080
git config --global --unset http.proxy
git config --global --unset https.proxy
npm config delete proxy
@liupeng0518
liupeng0518 / ansible-find-filenames.yml
Created August 5, 2022 06:01 — forked from Finkregh/ansible-find-filenames.yml
ansible: get files from directory - only names without path
- name: "get files from dir"
find:
paths: "/some/dir/foo"
register: found_files
- name: print file names without path
debug:
msg: "{{ found_files['files'] | map(attribute='path') | map('regex_replace','^.*/(.*)$','\\1') | list }}"
@liupeng0518
liupeng0518 / throttle-count.sh
Created June 7, 2022 11:45 — forked from simonsj/throttle-count.sh
How much time can be attributed to CPU throttling?
#!/bin/sh
# throttle-count.sh -- "how much time can be attributed to CPU throttling?"
stat_nodes=$(find /sys/fs/cgroup/cpu/kubepods -type f -name 'cpu.stat')
for stat_node in $stat_nodes; do
#
# Grab cpu.stat values which will end up looking something like:
#
@liupeng0518
liupeng0518 / docker-for-mac.md
Created November 1, 2021 06:51 — forked from BretFisher/docker-for-mac.md
Getting a Shell in the Docker Desktop Mac VM

2021 Update: Easiest option is Justin's repo and image

Just run this from your Mac terminal and it'll drop you in a container with full permissions on the Docker VM. This also works for Docker for Windows for getting in Moby Linux VM (doesn't work for Windows Containers).

docker run -it --rm --privileged --pid=host justincormack/nsenter1

more info: https://github.com/justincormack/nsenter1


@liupeng0518
liupeng0518 / Dockerfile-code-server.mips
Last active October 10, 2020 08:39
Dockerfile code-server mips
FROM loongnixk8stest/nodejs:12
RUN rm -rf /etc/yum.repos.d/epel-test.repo \
&& yum install -y \
make \
iproute \
libX11-devel \
libxkbfile-devel \
libsecret-devel \
gcc \
---
# Source: openstack-manila-csi/templates/controllerplugin-serviceaccount.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: openstack-manila-csi-controllerplugin
labels:
app: openstack-manila-csi
component: controllerplugin