Skip to content

Instantly share code, notes, and snippets.

View oldj's full-sized avatar
👨‍🚀
:-o

oldj oldj

👨‍🚀
:-o
View GitHub Profile
# -*- coding: utf-8 -*-
#
# Author: oldj
# Email: oldj.wu@gmail.com
# Blog: http://oldj.net
#
import os
import re
import StringIO
@oldj
oldj / GA.py
Last active July 2, 2023 09:26
py-TSP
# -*- coding: utf-8 -*-
"""GA.py
遗传算法类
"""
import random
from Life import Life
@oldj
oldj / gbk.js
Created January 6, 2015 03:16
GBK转码
/**//**//**//**//**//**//*
** ==================================================================================================
** 类名:J.gbk
** 版本:1.0
** 功能:URLEncode,URLDecode
** 示例:
---------------------------------------------------------------------------------------------------
用法:参见组件地址
@oldj
oldj / com.cocoatech.PathFinder.scpt
Created March 11, 2015 11:24
Path Finder support for GhostNote
tell application "Path Finder"
set theSelection to the selection
if theSelection is equal to missing value or the (count of items in theSelection) is 0 then
set theSelection to the name of the front window
return theSelection
else
return path of (item 1 of theSelection)
end if
end tell
@oldj
oldj / maze.p8
Created June 1, 2019 09:51
PICO-8
pico-8 cartridge // http://www.pico-8.com
version 18
__lua__
-- maze
_tt = 0
grids = {}
grid_size = 6
maze_width = 18
maze_height = 18
{"sig":"3e15fb07411f50009cfdf0ab530068b47a070dbfbc4a3c5462f69a0e9978c27c621316922aa6f2a5f928060612c8d41510da61b85e87549b098ec9aedd80432f0","msghash":"028aef50a39656cea5710bc21835bd08a8e180965609553130a305174fd33e30"}
@oldj
oldj / t.js
Last active April 10, 2017 06:46
计算阶乘
new Array(10)
.fill(0).map((_, i) => i)
.reduce((p, c, i) => p * (i + 1), 1); // 3628800
@oldj
oldj / fontlist.m
Last active February 6, 2017 05:56
macOS 输出系统支持的所有字体
#import <Cocoa/Cocoa.h>
int main(int argc, const char * argv[]) {
@autoreleasepool {
NSLog(@"%@", [[[NSFontManager sharedFontManager] availableFontFamilies] description]);
}
return 0;
}
#!/usr/bin/env bash
f=type_tmp
if [ ! -d ${f} ]
then
mkdir ${f}
fi
cd ${f}
if [ ! -f wkhtmltopdf ]
@oldj
oldj / get_ip_address.py
Created January 6, 2015 03:14
取得IP地址及主机名
import socket
name = socket.gethostname()
ip_addr = socket.gethostbyname(name)
print name
print ip_addr