Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# 文件名:flvget.sh
# 本脚本利用 http://www.flvurl.cn 或 http://www.flvcd.com 提供的服务解析在线视频并下载
# 受支持的站点列表见 http://www.flvurl.cn 及 http://www.flvcd.com
# 南浦月 http://blog.nanpuyue.com
# 2013-6-6
# 用法:
# flvget.sh <在线视频地址> [清晰度]
@nanpuyue
nanpuyue / youtube-list.sh
Created March 13, 2014 15:00
用于获取youtube播放列表内的所有视频地址
#!/bin/bash
#
# e.g.
# for https://www.youtube.com/playlist?list=PLL7JeXQtCv0MslQgUCV3DvKmaagaB9Nms use:
# youtube-list.sh PLL7JeXQtCv0MslQgUCV3DvKmaagaB9Nms
for i in \
`curl -s "https://www.youtube.com/playlist?list=$1" |\
grep -Po "/watch.*?$1" |\
sed -r "s#&.*##" | uniq`;
@nanpuyue
nanpuyue / day.pas
Created March 13, 2014 15:10
输入日期计算星期
program day;
var y,a,b,c,e,f:longint; m,d:word;
begin write('输入日期(年月日,以空格隔开):'); read(y,m,d);
a:=y div 4-y div 100+y div 400;
if (((y mod 4=0) and (y mod 100<>0)) or (y mod 400=0)) and ((m=1) or (m=2)) then b:=1 else b:=0;
c:=y+a+d-b;
case m of
1,10:e:=c+6;
2,3,11:e:=c+2;
4,7,12:e:=c+5;
@nanpuyue
nanpuyue / fonts-rename.sh
Last active July 1, 2023 12:48
读取字体文件内部名称并以此重命名字体文件文件。
#!/bin/bash
# 南浦月
# [email protected]
# 2013-5-11
# 用法:
# fonts-rename.sh <字体目录>
# fonts-rename.sh <字体文件>
--- a/glib/glib/gatomic.c 2012-07-14 17:03:45.000000000 -0500
+++ b/glib/glib/gatomic.c 2013-03-08 14:56:54.644462500 -0600
@@ -464,7 +464,7 @@ gsize
return g_atomic_pointer_xor ((volatile gpointer *) atomic, val);
}
-#elif defined (G_PLATFORM_WIN32)
+#elif defined (G_OS_WIN32)
#include <windows.h>
@nanpuyue
nanpuyue / make-ext4fs_2015-12-02-cygwin.patch
Created January 11, 2016 16:15
make-ext4fs(2015-12-02) pacth for cygwin
diff -ru a/ext4_utils.h b/ext4_utils.h
--- a/ext4_utils.h 2016-01-10 21:05:12.000000000 +0800
+++ b/ext4_utils.h 2016-01-11 23:55:44.369117700 +0800
@@ -38,7 +38,7 @@
#include <setjmp.h>
#include <stdint.h>
-#if defined(__APPLE__) && defined(__MACH__)
+#if (defined(__APPLE__) && defined(__MACH__)) || defined(__CYGWIN__)
#define lseek64 lseek
@nanpuyue
nanpuyue / e2fsprogs_1.42.13-cygwin.patch
Last active January 11, 2016 18:55
e2fsprogs(1.42.13) patch for cygwin
diff -ru a/configure b/configure
--- a/configure 2014-12-01 05:34:31.000000000 +0800
+++ b/configure 2016-01-12 02:51:41.574547800 +0800
@@ -4273,7 +4273,7 @@
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
-if test "$GCC" = yes; then
+if test "$GCC" = yes && test "$host_os" != cygwin; then
RDYNAMIC="-rdynamic"
@nanpuyue
nanpuyue / mtd-utils_1.5.2-cygwin.patch
Created January 12, 2016 13:57
mtd-utils(1.5.2) patch for cygwin
diff -ruN a/include/cygwin/ioctl.h b/include/cygwin/ioctl.h
--- a/include/cygwin/ioctl.h 1970-01-01 08:00:00.000000000 +0800
+++ b/include/cygwin/ioctl.h 2016-01-12 21:54:55.562295400 +0800
@@ -0,0 +1,38 @@
+#ifndef _CYGIOCTL_H_
+#define _CYGIOCTL_H_
+
+#ifdef __CYGWIN__
+
+#define _IOC_NRBITS 8
@nanpuyue
nanpuyue / mklink_for_cygwin_bin.sh
Created January 13, 2016 03:35
mklink for openwrt toolchain bin on cgywin/windows
@nanpuyue
nanpuyue / live_initrd_on_exfat.sh
Last active June 14, 2021 00:44
Generate the initrd for Debian/Deepin/Ubuntu Live that supported boot from iso on an exfat partition, then you can generate the new iso by “ISO Master”. Tested for Deepin 15.3, Debian 8.5 & Ubuntu 16.04.1.
#!/bin/bash
# (c) 2016 nanpuyue <[email protected]>
# usage:sudo ./live_initrd_on_exfat.sh deepin-15.3-amd64.iso
NAMESERVER="1.2.4.8"
EXFAT_BIN="sbin/mount.exfat"
FILE_LIST="sbin/mount.exfat sbin/mount.exfat-fuse lib/x86_64-linux-gnu/libfuse.so.*"
ISO=$(readlink -f "$1")