Skip to content

Instantly share code, notes, and snippets.

View beyoung's full-sized avatar
🥋
Focusing

beyoung beyoung

🥋
Focusing
View GitHub Profile
import time
# Make sure you have duckdb==0.7.0. Earlier versions might fail with GIL problems ( https://twitter.com/mr_le_fox/status/1620535141675433986 )
import duckdb
import s3fs
from fsspec.implementations.cached import SimpleCacheFileSystem
# Create the s3 file system. This one does not have caching
@syhily
syhily / download_talebook.sh
Last active January 9, 2023 08:01
Download all the books from a talebook website. The https://curl.se/ and https://stedolan.github.io/jq/ are required for using this script.
#!/usr/bin/env bash
# Download metadata, modify these as your needs.
## The directory to save the downloaded files.
download_directory="/volume1/Download/EPUB"
## The website you want to visit.
calibre_site="http://soulseeker.myds.me:25788"
## The formats you want to download. We only download the first present format.
## All the formats should be upper case.
allow_formats=( EPUB MOBI AZW3 )
@saamerm
saamerm / SwiftUICoreMotionView.swift
Last active May 22, 2024 05:12
Sample using CoreMotion and SwiftUI to help understand how to use CMMotionManager and CoreMotion to get values of gravity, user acceleration, heading (2), attitude (pitch, roll, yaw), magnetic field
// Sample using CoreMotion and SwiftUI to help understand how to use CMMotionManager and CoreMotion to get values of gravity, user acceleration, heading (2), attitude (pitch, roll, yaw), magnetic field
// based on this beautiful example https://github.com/gsachin/DynamicFontRandD/blob/e4f7cc611d1d23573b4026bcc291bee60bf60e91/FontTextStrok/WaveView.swift
// that uses BAFluidView https://github.com/antiguab/BAFluidView
import SwiftUI
import CoreMotion
let timer = Timer.publish(every: 1, on: .main, in: .common).autoconnect()
struct WaveView: View {
var motionManager = CMMotionManager()
use_bpm 100
live_loop :pad do
chords = [
[:a2, :g3, :c4, :e4],
[:d2, :f3, :c4, :e4],
[:g2, :f3, :a3, :d4],
[:c2, :g3, :d4, :e4]
]
@Koze
Koze / speechVoices.tsv
Last active March 27, 2024 11:48
List of AVSpeechSynthesisVoice.speechVoices() on iOS Device
Language Name Quality Identifier Class
ar-SA Maged Default com.apple.ttsbundle.Maged-compact AVSpeechSynthesisVoice
cs-CZ Zuzana Default com.apple.ttsbundle.Zuzana-compact AVSpeechSynthesisVoice
da-DK Sara Default com.apple.ttsbundle.Sara-compact AVSpeechSynthesisVoice
de-DE Anna Default com.apple.ttsbundle.Anna-compact AVSpeechSynthesisVoice
de-DE Helena Default com.apple.ttsbundle.siri_female_de-DE_compact AVSpeechSynthesisVoice
de-DE Martin Default com.apple.ttsbundle.siri_male_de-DE_compact AVSpeechSynthesisVoice
el-GR Melina Default com.apple.ttsbundle.Melina-compact AVSpeechSynthesisVoice
en-AU Catherine Default com.apple.ttsbundle.siri_female_en-AU_compact AVSpeechSynthesisVoice
en-AU Gordon Default com.apple.ttsbundle.siri_male_en-AU_compact AVSpeechSynthesisVoice
@lizrice
lizrice / hello_map.py
Last active July 19, 2023 08:20
eBPF hello world
#!/usr/bin/python
from bcc import BPF
from time import sleep
# This outputs a count of how many times the clone and execve syscalls have been made
# showing the use of an eBPF map (called syscall).
program = """
BPF_HASH(syscall);
@bskaggs
bskaggs / Dockerfile
Last active May 7, 2024 07:24
Install pyarrow on alpine in docker
FROM python:3.7-alpine3.8
RUN apk add --no-cache \
build-base \
cmake \
bash \
jemalloc-dev \
boost-dev \
autoconf \
zlib-dev \
@hellokaton
hellokaton / README.md
Last active March 29, 2024 02:33
Go 的信号处理和优雅退出

每个平台的信号定义或许有些不同。下面列出了POSIX中定义的信号。 Linux 使用34-64信号用作实时系统中。 命令man 7 signal提供了官方的信号介绍。

在POSIX.1-1990标准中定义的信号列表

@twelch
twelch / index.html
Last active February 9, 2020 05:36
Mapbox GL JS compare window circle magnifying glass
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.46.0/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.46.0/mapbox-gl.css' rel='stylesheet' />
<script src='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-compare/v0.1.0/mapbox-gl-compare.js'></script>
</head>
<body>
@Krazybug
Krazybug / omercy.py
Last active February 27, 2023 14:19
O'Reilly free ebooks downloader
'''
O'Meirrcy !!!! Download free ebooks from O'Reilly
Usage:
> git clone https://gist.github.com/Krazybug/1ae50814d25b0a1d862dfdf7161ee503
> mv 1ae50814d25b0a1d862dfdf7161ee503 omercy
> cd omercy
> pip install requests
> pip install bs4
> python omercy.py