Skip to content

Instantly share code, notes, and snippets.

View alexiscn's full-sized avatar
💭
Working on Fileball

alexiscn

💭
Working on Fileball
View GitHub Profile
@alexiscn
alexiscn / UIButton+VerticalCenter.swift
Last active September 16, 2022 10:54
iOS Button ImageView and titleLabel align vertically center
import UIKit
extension UIButton {
func alignVerticalCenter(padding: CGFloat = 7.0) {
guard let imageSize = imageView?.frame.size, let titleText = titleLabel?.text, let titleFont = titleLabel?.font else {
return
}
let titleSize = (titleText as NSString).size(withAttributes: [.font: titleFont])
[
{
"filter": "IGNormalFilter",
"fragmentShader": "",
"filterName": "Normal",
"samplers": {},
"vertexShader": "",
"fullVertexShader": "attribute vec3 a_position; attribute vec2 a_texCoord; uniform mat4 u_contentTransform; uniform mat4 u_texCoordTransform; varying vec2 textureCoordinate; varying vec2 sourceTextureCoordinate; void main() { gl_Position = u_contentTransform * vec4(a_position, 1.0); textureCoordinate = a_texCoord + vec2(0.5); vec4 texel = u_texCoordTransform * vec4(a_texCoord, 0.0, 1.0); sourceTextureCoordinate = texel.xy / texel.w + vec2(0.5); }",
"fullFragmentShader": "precision mediump float;varying vec2 textureCoordinate; varying vec2 sourceTextureCoordinate;\nuniform sampler2D s_texture; void main() { vec4 texel = texture2D(s_texture, sourceTextureCoordinate);vec4 inputTexel = texel; \ngl_FragColor = texel;\n}"
},
@alexiscn
alexiscn / group_defender_bot.py
Last active September 23, 2022 09:28
Telegram Group Defender Bot. A simple bot that disable sending media messages at 22:00(+08:00) and enable sending media messages at 08:00(+08:00).
import logging
from telegram import Update, ChatPermissions
from telegram.ext import ApplicationBuilder, ContextTypes, CommandHandler
from datetime import time
logging.basicConfig(
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
level=logging.INFO
)
#EXTM3U
#EXTINF:-1,抖音
https://pull-flv-spe-l6.douyinliving.com/fantasy/stream-112002057447932598_spuhd.flv?_neptune_token=MIGmBAwyZDtee6HN_VoUQGoEgYMznrOf-FuQKuoiK0Lp0TPxQb9M_8bhzneSk7LMc8cQ_BOmQAkEUOdQVdd8eLxrX4IZKCvXIiWB194ZH1DJ4mtW12g1V2WuvrYwKaZTh0moCSZKsjKuTsoLEBIotryoWC4B-KavsQGAlgwQuFJ1noO9NVfVbJoi-HLCq-dfagYHkJ55qwQQqYUhho4rqfFaTkFnEMTbig&k=0a5e79abb2dfece7&t=1669121423&abr_pts=-1800
#EXTINF:-1,CCTV16
http://live.misakaf.org/hls/stream.m3u8
[Script Info]
Collisions: Normal
PlayResX: 384
PlayResY: 288
ScaledBorderAndShadow: no
ScriptType: v4.00+
Synch Point: 1
[V4+ Styles]
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding