Skip to content

Instantly share code, notes, and snippets.

View lovemyliwu's full-sized avatar
😍
feel free

Smite Chow lovemyliwu

😍
feel free
View GitHub Profile
@lovemyliwu
lovemyliwu / shapely_linestring_cases.md
Last active December 29, 2023 09:14
shapely 线段操作
  1. 平移
>>> line=shapely.LineString([(0,0.3), (0.3,0)])
>>> line.parallel_offset(0.13, side="right")
<LINESTRING (0.092 0.392, 0.392 0.092)>
  1. 计算弧度radian,角度angle
origin=(0,0)
@lovemyliwu
lovemyliwu / command
Created November 3, 2023 03:02
how to use custom url protocol to open folder on windows
cmd /C "call set arg=%1% &&call set uri=%%arg:explorer://=%% && call echo %%uri%% && call C:\Windows\explorer.exe %%uri:/=\%%"
@lovemyliwu
lovemyliwu / do.md
Created November 4, 2023 08:25
change resolution for centos 7 on hyper-v

hyper-v

via: LIS/lis-next#318

Set-VMVideo -VMName centos -HorizontalResolution 2560 -VerticalResolution 1440 -ResolutionType Single
Get-VMVideo centos

centos 7

class CustomTask(Task):
def on_failure(self, exc, task_id, args, kwargs, einfo):
info = '[{0}] failed: {1}'.format(task_id, exc)
logger.exception(info, exc_info=exc)
super(CustomTask, self).on_failure(exc, task_id, args, kwargs, einfo)
def on_success(self, retval, task_id, args, kwargs):
global app
if app.is_warm_shutdown:
app.consumer.connection._default_channel.do_restore = False
@lovemyliwu
lovemyliwu / fix.md
Last active August 3, 2023 11:47
stackedit collaps support details tag

use custom template

{{{files.0.content.html}}}
<script>
document.querySelectorAll('.step-details').forEach(item=>{
item.outerHTML=`<details>${item.innerHTML}</details>`
})
document.querySelectorAll('.step-summary').forEach(item=>{
item.outerHTML=`${item.innerHTML}`
@lovemyliwu
lovemyliwu / china-unicom-cdn.md
Last active June 10, 2023 16:53
使用联通cdn加速下载

120.52.72.*/original-uri

ip 地址获取脚本

window.success = [];
function test() {
    for(var idx=1;idx<255;idx++){
        var el = document.createElement('img');
        el.src = '//120.52.72.' + idx + '/41.media.tumblr.com/5cb6715c800c5b00969f33c162b317d1/tumblr_nzjh7dPKcD1ssbwqro1_540.png';
@lovemyliwu
lovemyliwu / wifi_watch_dog.sh
Last active January 28, 2023 07:51
auto reconnect wifi after kick out by router on ubuntu
#!/bin/bash
check_internet_connection() {
return $(ping -c 1 www.baidu.com > /dev/null)
}
SSID=$1
PW=$2
while [ 1 ]; do
check_internet_connection
@lovemyliwu
lovemyliwu / cli.py
Last active October 22, 2022 09:26
python connect smb server through windows domain user
import sys
from optparse import OptionParser
from smb.SMBConnection import SMBConnection
def main(argv):
parser = OptionParser()
parser.add_option("-u", "--username",
help="windows username that will be used for authentication")
parser.add_option("-p", "--password",
// ==UserScript==
// @name 今年GitHub成绩单
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// @require http://yckart.github.io/jquery.base64.js/jquery.base64.js
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author Smite Chow
// @match https://github.com/*?show_current_year_statistic
// @match https://github.com/*/graphs/contributors?from=*-01-01&to=*-12-31&type=c
import binascii
file = open('douyin_signature.csv', 'wb')
bom = binascii.unhexlify(''.join("EF BB BF".split()))
file.write(bom)
file.write('unique_id,signature'.encode())
def get_signature(unique_id):
import requests
response = requests.get(f'https://www.iesdouyin.com/web/api/v2/user/info/?unique_id={unique_id}').json()
return response['user_info']['signature']