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
@sindresorhus
sindresorhus / PHImageManager-requestImage-async.swift
Created November 3, 2021 05:46
How to use `PHImageManager#requestImage` with async/await in Swift.
import Photos
struct UnexpectedNilError: Error {}
extension PHImageManager {
func requestImage(
for asset: PHAsset,
targetSize: CGSize,
contentMode: PHImageContentMode,
options: PHImageRequestOptions?
@vetch
vetch / dlmusic
Last active September 2, 2016 00:58
download 320kbps music from xiami.com
#!/usr/bin/env python
#-*-coding:utf8-*-
"""
vesion2.0
这个脚本的作用是通过输入某首歌页面的url,来实现这首歌的下载,保存到当前工作目录下。
目前可以实现高音质音乐的下载,无须账号登陆。
比如,When I'm Sixty-Four的页面的url是 http://www.xiami.com/song/1003908
download_hq_music('http://www.xiami.com/song/1003908'),将会实现When I'm Sixty-Four的320k版本下载
@tomasbasham
tomasbasham / UIImage+Scale.m
Last active February 1, 2024 19:04
Scale a UIImage to any given rect keeping the aspect ratio
@implementation UIImage (scale)
/**
* Scales an image to fit within a bounds with a size governed by
* the passed size. Also keeps the aspect ratio.
*
* Switch MIN to MAX for aspect fill instead of fit.
*
* @param newSize the size of the bounds the image must fit within.
* @return a new scaled image.
@PeterDing
PeterDing / xiami_vip_linux.py
Last active April 9, 2017 18:34
在linux上,下载 xiami.com 320Kbps mp3 -- # 移到仓库 https://github.com/PeterDing/iScript
#!/usr/bin/env python2
# vim: set fileencoding=utf8
import re, sys, os, random, time, json, logging, argparse, requests, urllib
from mutagen.id3 import ID3,TRCK,TIT2,TALB,TPE1,APIC,TDRC,COMM,TPOS,USLT
from HTMLParser import HTMLParser
parser = HTMLParser()
s = u'\x1b[1;%dm%s\x1b[0m' # terminual color template