Skip to content

Instantly share code, notes, and snippets.

View Lincest's full-sized avatar
🏸
A small piece of matter

Moreality Lincest

🏸
A small piece of matter
View GitHub Profile
@Lincest
Lincest / front-matter.yml
Created August 7, 2020 17:29
maverick front matter
---
layout: post
title: xxx
slug: xxx
date: 2020-08-07 9:08
status: publish
author: roccoshi
categories:
- xxxx
tags:
@Lincest
Lincest / ffmpeg
Created August 8, 2020 01:29
ffmpeg合并音视频
ffmpeg -i video.mp4 -i audio.wav -c:v copy -c:a aac -strict experimental -map 0:v:0 -map 1:a:0 output.mp4
@Lincest
Lincest / protect.js
Last active August 8, 2020 15:53
保护源码
<script type="text/javascript">
document.onkeydown = function(){
if(window.event && window.event.keyCode == 123) {
alert("F12 is blocked");
event.keyCode=0;
event.returnValue=false;
}
if(window.event && window.event.keyCode == 13) {
window.event.keyCode = 505;
@Lincest
Lincest / telegram-bot.gs
Created August 11, 2020 11:34
telegram-bot.gs
function doGet(e){
return HtmlService.createHtmlOutput("你好,我是一个新的机器人服务请求!");
}
function doPost(e){
var dataFromTelegram = {
"method": "post",
"payload": e.postData.contents
}
@Lincest
Lincest / googlevoice-bot.gs
Created August 11, 2020 11:35
googlevoice-bot
function autoReplier() {
var labelObj = GmailApp.getUserLabelByName('autoreply');
var gmailThreads;
var messages;
var sender;
for (var gg = 0; gg < labelObj.getUnreadCount(); gg++) {
gmailThreads = labelObj.getThreads()[gg];
messages = gmailThreads.getMessages();
for (var ii = 0; ii < messages.length; ii++) {
@Lincest
Lincest / whiteSquare.py
Last active August 20, 2020 15:22
将图片填充成正方形白底( 发微博? )
from PIL import Image
import os
# JPG文件
def jpg_square(im, min_size=256, fill_color=(255, 255, 255)):
x, y = im.size
size = max(min_size, x, y)
new_im = Image.new('RGB', (size, size), fill_color)
new_im.paste(im, (int((size - x) / 2), int((size - y) / 2)))
return new_im
@Lincest
Lincest / concat.py
Created January 25, 2021 06:15
将多张图片拼接成大图
import os
import PIL.Image as Image
def resize_by_width(infile, image_size):
"""按照宽度进行所需比例缩放"""
im = Image.open(infile)
(x, y) = im.size
lv = round(x / image_size, 2) + 0.01
@Lincest
Lincest / Dijkstra.cpp
Last active March 8, 2021 14:23
Dijkstra
/**
* author: roccoshi
* created: 2021-03-08 21:34:14
* description:
dijkstra + priority_queue
test_cases:
node1 node2 distance
[[1,2,3],[1,3,3],[2,3,1],[1,4,2],[5,2,2],[3,5,1],[5,4,10]]
*/
#pragma GCC diagnostic ignored "-Wsign-conversion"
@Lincest
Lincest / gh-check
Created March 10, 2021 06:19 — forked from lilydjwg/gh-check
gh-check: speed test to known GitHub IPs
#!/usr/bin/python3
import asyncio
import time
import socket
import argparse
import aiohttp
class MyConnector(aiohttp.TCPConnector):
@Lincest
Lincest / crc32crack.cpp
Created March 24, 2021 04:46
查找bilibili匿名弹幕
#include <bits/stdc++.h>
using namespace std;
#define CRCPOLYNOMIAL 0xEDB88320
vector<unsigned long> crc_table(255, 0);
string buffer;
void get_crc_table() {
unsigned long crc;
int i, j;