Skip to content

Instantly share code, notes, and snippets.

@fasthold
fasthold / pandoc.css
Created October 11, 2023 07:40 — forked from killercup/pandoc.css
Add this to your Pandoc HTML documents using `--css pandoc.css` to make them look more awesome. (Tested with Markdown and LaTeX.)
/*
* I add this to html files generated with pandoc.
*/
html {
font-size: 100%;
overflow-y: scroll;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}
@fasthold
fasthold / ContentScreen.js
Created April 3, 2023 06:29
React Native 加载webview网页时,后退按钮定义为网页返回而不是整体screen返回
import { SafeAreaView, StyleSheet, Text, View, ActivityIndicator, BackHandler } from 'react-native';
import React, { useRef, useState, useEffect } from 'react';
import { WebView } from 'react-native-webview';
const Contents = ({ navigation }) => {
const webViewRef = useRef()
const [isLoading, setLoading] = useState(false);
const handleBackButtonPress = () => {
if (webViewRef.current.canGoBack) {
@fasthold
fasthold / install-22.04.sh
Last active November 13, 2024 04:55
Ubuntu 22.04 PHP MySQL
# 切换阿里云源
mv /etc/apt/sources.list /etc/apt/sources.list.bak
bash -c "cat << EOF> /etc/apt/sources.list && apt update
deb http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse
@fasthold
fasthold / block ads for v2ray
Last active April 12, 2022 09:59
ad block domains
domain:pglstatp-toutiao.com,
domain:pangolin-sdk-toutiao.com,
domain:pangolin-sdk-toutiao-b.com,
domain:hykjdd.com,
domain:mobads.baidu.com,
domain:tracking.miui.com,
domain:ad.xiaomi.com,
domain:applog.uc.cn,
domain:qh-material.taobao.com,
domain:tdlog.tangdou.com,
FROM ubuntu:20.04
WORKDIR /var/www/html
ENV DEBIAN_FRONTEND=noninteractive
RUN sed -i "s@http://.*archive.ubuntu.com@http://mirrors.huaweicloud.com@g" /etc/apt/sources.list
RUN sed -i "s@http://.*security.ubuntu.com@http://mirrors.huaweicloud.com@g" /etc/apt/sources.list
RUN apt-get update
RUN apt-get install -y build-essential apt-utils curl software-properties-common g++ make git
127.0.0.1 govchengdu.cn
127.0.0.1 vipwm.cc
127.0.0.1 govxian.cn
@fasthold
fasthold / source.list
Last active August 29, 2015 14:20
ubuntu 14.04 aliyun source
deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
@fasthold
fasthold / curl_download_progress.php
Last active November 24, 2016 00:33
PHP使用curl下载文件时输出下载进度
<?php
// 现在输出是没问题了,但是实际保存为文件还有问题
// from: http://stackoverflow.com/questions/13958303/curl-download-progress-in-php
// 原文中的代码有bug,作了修改
$url = 'http://ipv4.speedtest-sgp1.digitalocean.com/10mb.test';
echo "<pre>";
echo "Loading ...";
ob_flush();
flush();
# System related
sudo apt-get update
sudo apt-get -y install build-essential ssh curl software-properties-common python-software-properties python g++ make
# VCS
sudo apt-get -y install subversion git
# Web Server
sudo apt-get -y install apache2
# php
@fasthold
fasthold / sites-enabled.conf
Last active August 29, 2015 14:04
给其他安装脚本提供支持。非特殊情况勿改。
ServerName localhost
<VirtualHost *:80> ServerAdmin webmaster@localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options FollowSymLinks MultiViews Includes -Indexes