View Cargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[package] | |
name = "unshare" | |
version = "0.1.0" | |
edition = "2021" | |
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | |
[dependencies] | |
nix = { version = "0.26.1", features = ["sched", "mount"] } |
View xdp-screen-cast.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
# Original script: https://gitlab.gnome.org/-/snippets/19 | |
# Sharing wayland screen/window with portal + pipewire to X programs | |
# Modifications: | |
# 1. Add --show-cursor option | |
# 2. Fix the bug that the script won't exit after the window is closed | |
# Known bugs: | |
# 1. Screencasting monitors without top bar may not work smoothly in GNOME | |
# (Contents of xvimagesink window may not updated when not focused |
View script.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import datetime | |
# you need python-notify2 | |
import notify2 | |
import time | |
def main(): | |
now = datetime.datetime.now() | |
title = "Time Notification" |
View xfsquota-telegraf.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import argparse | |
import subprocess as sp | |
def main(): | |
command = ["/sbin/xfs_quota", "-c", "free -N"] | |
ret = sp.run(command, stdout=sp.PIPE) | |
if ret.returncode != 0: |
View qr.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <math.h> | |
#include <omp.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#define MIN(x, y) ((x) < (y) ? (x) : (y)) | |
int n; | |
void givens(int from_row, int start_row, int end_row, double (*a)[n], double (*q)[n]) { |
View qt5.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Modified from https://gist.github.com/mrfaptastic/80e909c9a8237994471bce2d17657779 | |
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | |
# THE SOFTWARE. | |
# Tested with QT 5.15.2 on Windows 10 |
View Dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM centos:6 | |
RUN echo "207.241.237.3 web.archive.org" >> /etc/hosts && \ | |
curl https://web.archive.org/web/20140123032613if_/http://download3.vmware.com/software/vmw-tools/vibauthor/vmware-esx-vib-author-5.0.0-0.0.847598.i386.rpm > /tmp/vibauthor.rpm && \ | |
sed -e "s|^mirrorlist=|#mirrorlist=|g" \ | |
-e "s|^#baseurl=http://mirror.centos.org/centos/\$releasever|baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/6.10|g" \ | |
-i.bak \ | |
/etc/yum.repos.d/CentOS-*.repo && \ | |
yum makecache && \ | |
yum install -y python-lxml && \ |
View main.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import glob | |
import sys | |
configs = glob.iglob("/your/gitlab/path/repositories/@hashed/*/*/*.git/config") | |
keyword = sys.argv[1] | |
print("keyword", keyword) | |
for i in configs: | |
with open(i) as f: |
View analyze.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sys import stdin | |
from collections import defaultdict | |
def analyze(line): | |
state = 0 | |
for idx, c in enumerate(line): | |
if state == 0: | |
if c == ']': | |
if line[idx + 2:idx + 6] == "send": | |
state = 1 |
View 1.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
rm -f /tmp/failure | |
~/executor/executor -shell 'sleep 3 && ping' > /tmp/log || touch /tmp/failure & | |
~/executor/executor ls > /tmp/log2 || touch /tmp/failure && | |
wait | |
test -f /tmp/failure && echo failed! && exit 1 | |
exit 0 |
NewerOlder