Skip to content

Instantly share code, notes, and snippets.

View flydo's full-sized avatar
💭
I may be slow to respond.

扉度 flydo

💭
I may be slow to respond.
View GitHub Profile
@lazuee
lazuee / delete-workflows-run.sh
Created October 4, 2023 02:25
Delete workflow runs
#!/bin/bash
repo="lazuee/lazuee"
url="repos/$repo/actions/runs"
total_deleted=0
delete_id() {
local id=$1
local result=""
@pckilgore
pckilgore / remove_workflow_runs.sh
Last active May 10, 2023 07:24
Batch Delete Github Workflow Runs Shell Script
#!/bin/bash
ORG_NAME=$1
REPO_NAME=$2
WORKFLOW_NAME=$3
if [[ -z $WORKFLOW_NAME || -z REPO_NAME || -z ORG_NAME ]]; then
echo "Usage: bash remove_workflow_runs.sh <USER/ORG NAME> <REPO NAME> <WORKFLOW NAME>"
exit 1
fi
@sparrc
sparrc / install-ffmpeg.sh
Last active November 14, 2023 13:24
Installs ffmpeg with libaom and libx265 enabled for av1 and hevc encoding (tested on Ubuntu 16.04)
#!/usr/bin/env bash
# Installs ffmpeg from source (HEAD) with libaom and libx265, as well as a few
# other common libraries
# binary will be at ~/bin/ffmpeg
sudo apt update && sudo apt upgrade -y
mkdir -p ~/ffmpeg_sources ~/bin
export PATH="$HOME/bin:$PATH"
@crgimenes
crgimenes / stringToReaderCloser.go
Last active April 11, 2024 15:41
string to io.ReadCloser
package main
import (
"bytes"
"fmt"
"io"
"os"
"strings"
)
@anikitenko
anikitenko / gist:b41206a49727b83a530142c76b1cb82d
Created October 11, 2017 07:41
[Golang] Convert size in bytes to Bytes, Kilobytes, Megabytes, GB and TB
package main
import (
"fmt"
"math"
"strconv"
)
var (
sizeInMB float64 = 999 // This is in megabytes
@r0l1
r0l1 / copy.go
Last active March 23, 2024 12:38
Copy a directory tree (preserving permissions) in Go.
/* MIT License
*
* Copyright (c) 2017 Roland Singer [roland.singer@desertbit.com]
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
@littlecodersh
littlecodersh / main.py
Last active June 4, 2024 06:32
Main script behind itchat robot
#coding=utf8
import itchat
# tuling plugin can be get here:
# https://github.com/littlecodersh/EasierLife/tree/master/Plugins/Tuling
from tuling import get_response
@itchat.msg_register('Text')
def text_reply(msg):
if u'作者' in msg['Text'] or u'主人' in msg['Text']:
return u'你可以在这里了解他:https://github.com/littlecodersh'
@lukechilds
lukechilds / get_latest_release.sh
Created August 9, 2016 19:43
Shell - Get latest release from GitHub
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}
# Usage
# $ get_latest_release "creationix/nvm"
# v0.31.4
@zhang0098
zhang0098 / gbkbig5.go
Last active September 14, 2022 13:32
Golang GBK Big5 from/to UTF-8 转换
import (
"bytes"
"io/ioutil"
"golang.org/x/text/encoding/traditionalchinese"
"golang.org/x/text/encoding/simplifiedchinese"
"golang.org/x/text/transform"
)
//convert GBK to UTF-8
func Decodegbk(s []byte) ([]byte, error) {
I := bytes.NewReader(s)
@fj
fj / gist:1597544
Created January 11, 2012 23:51
Slightly nicer way of writing large files to disk with PHP
// Copy big file from somewhere else
$src_filepath = 'http://example.com/all_the_things.txt'; $src = fopen($src_filepath, 'r');
$tmp_filepath = '...'; $tmp = fopen($tmp_filepath, 'w');
$buffer_size = 1024;
while (!feof($src)) {
$buffer = fread($src, $buffer_size); // Read big file/data source/etc. in small chunks
fwrite($tmp, $buffer); // Write in small chunks
}