Skip to content

Instantly share code, notes, and snippets.

View journey-ad's full-sized avatar
🍭
关注嘉然,顿顿解馋

Jad journey-ad

🍭
关注嘉然,顿顿解馋
View GitHub Profile
@journey-ad
journey-ad / gnome_wallpaper_helper.sh
Last active February 26, 2024 07:30
生成壁纸列表xml并应用到系统,适用于gnome
#!/bin/bash
DIR1="`dirname $BASH_SOURCE`"
DIR=`readlink -f "$DIR1"`
files=$(find "$DIR" -maxdepth 3 -iregex ".*\.\(png\|jpg\|jpeg\|bmp\|gif\)$")
last_file="empty"
mode=${1:-zoom}
xml=${2:-"mylist.xml"}
static=${3:-600.0}
transition=${4:-5.0}
echo `date`
@journey-ad
journey-ad / abu.sh
Created November 15, 2016 14:54
thanks for 荆棘的思念(http://tieba.baidu.com/p/4754939962)
#!/bin/bash
function __main__(){
BACKUP_DIR=${HOME}/.autobackup
local op=${1}
shift
case ${op} in
"init")
init ${@}
@journey-ad
journey-ad / earth_live.py
Created March 26, 2017 03:01
实时获取向日葵8号卫星图片并应用为壁纸(gnome)
#!/usr/bin/env python
import os
import sys
import json
import requests
from PIL import Image
from io import BytesIO
from datetime import datetime
from dateutil import tz
import time
@journey-ad
journey-ad / share-your-bookmarks-with-me.py
Created March 30, 2017 14:43
转换你的 chrome 书签为 HTML 格式并分享给我
#!/usr/bin/python
# -*- coding: utf-8 -*-
# share-your-bookmarks-with-me
#
# 转换你的 chrome 书签为 HTML 格式并分享给我
#
# Copyright (c) 2017 journey.ad
# This program is released under the ISC license.
from __future__ import print_function
@journey-ad
journey-ad / bilibili_api.lua
Created June 15, 2017 11:34 — forked from mimosa/bilibili_api.lua
B站 api key 规则,每3小时轮换一个 :(
function string.fh(str)
return (str:gsub('..', function (cc)
return string.char(tonumber(cc, 16))
end))
end
function sort_nums()
return ("6337393836663535306539363566613865616264646435653033363665356466"):fh()
end
bit = require('bit')
@journey-ad
journey-ad / t.fish
Last active April 11, 2018 08:41
fish shell 的自定义函数,用于翻译文本
function t
set pid "debc40e19e8f3675ee1f93b480ec3104"
set key "51b3cc5bb7d97d0c02e8bbd8fbbd84cd"
set text $argv[1]
set lang "auto"
echo -n $text | grep -Pq "[\p{Han}]"
if test $status -eq 0
echo -n $text | grep -Pq "[\p{Hiragana}\p{Katakana}]"
if test $status -eq 0
set transto zh-CHS
@journey-ad
journey-ad / say.fish
Last active August 14, 2017 03:59
fish shell 的自定义函数,用于读出一段文本(类似于 macOS 的 say 命令)
function say
set text $argv[1]
set text (echo $text | tr -d '\n')
set salt (date +%s)
set str1 "2015063000000001""$text""$salt""12345678"
set sign (echo -n $str1 | md5sum | cut -d ' ' -f1)
set lang (curl -s "http://api.fanyi.baidu.com/api/trans/vip/translate?from=$lang&to=$transto&appid=2015063000000001&salt=$salt&sign=$sign" --data-urlencode "q=$text" | grep -oP '(?<="from":")[^"]*')
for i in (echo $argv | sed 's|--*|\\'\n'|g' | sed 's/[ \t]*$//g' | grep -v '^$')
echo $i | read -l option value
switch $option
@journey-ad
journey-ad / ImageVector.cs
Created October 26, 2017 05:32 — forked from ksasao/ImageVector.cs
C#による高速画像一致検索クラス。フル版は https://github.com/ksasao/Gochiusearch にあります。
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
@journey-ad
journey-ad / fetchPixivFavIds.js
Last active February 26, 2024 07:29
抓取P站收藏ID
var ids = [];
function logcat(data, level){
level = level.toUpperCase();
if(level === 'I'){
console.info('Info:', data);
}else if(level === 'W'){
console.warn('Warning:', data);
}else if(level === 'E'){
console.error('Error:', data);
}else{
@journey-ad
journey-ad / SMBDIS.ASM
Created January 23, 2018 11:59 — forked from 1wErt3r/SMBDIS.ASM
A Comprehensive Super Mario Bros. Disassembly
;SMBDIS.ASM - A COMPREHENSIVE SUPER MARIO BROS. DISASSEMBLY
;by doppelganger (doppelheathen@gmail.com)
;This file is provided for your own use as-is. It will require the character rom data
;and an iNES file header to get it to work.
;There are so many people I have to thank for this, that taking all the credit for
;myself would be an unforgivable act of arrogance. Without their help this would
;probably not be possible. So I thank all the peeps in the nesdev scene whose insight into
;the 6502 and the NES helped me learn how it works (you guys know who you are, there's no