Skip to content

Instantly share code, notes, and snippets.

View creamidea's full-sized avatar

NekoTrek creamidea

View GitHub Profile
@creamidea
creamidea / BigDecimal.js
Created January 11, 2018 09:42 — forked from xinlc/BigDecimal.js
JavaScript高精度计算
//除法函数,用来得到精确的除法结果
//说明:javascript的除法结果会有误差,在两个浮点数相除的时候会比较明显。这个函数返回较为精确的除法结果。
//调用:accDiv(arg1,arg2)
//返回值:arg1除以arg2的精确结果
function accDiv(arg1, arg2) {
var t1 = 0,
t2 = 0,
r1, r2;
try {
t1 = arg1.toString().split(".")[1].length
@creamidea
creamidea / splid_words.html
Created July 4, 2017 15:03 — forked from onlytiancai/splid_words.html
javascript实现的正向最大匹配机械分词
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>test</title>
</head>
<body>
<script type="text/javascript">
/*
* @description 原始词库
*/
@creamidea
creamidea / ReadMe.Txt
Created March 30, 2017 04:03 — forked from jb510/ReadMe.md
OS X LaunchD job and script to automaticaly update homebrew
1. Place homebrewupdate.sh where ever you like, I use ~/bin/homebrewupdate.sh
2. Place the .plist file in ~/Library/LaunchAgents and update the path to your bash script
3. run 'launchctl load ~/Library/LaunchAgents/com.jb510.homebrewupdate.plist' or whatever you've named your plist file.
4. check 'launchctl list | grep jb510' to see that it's running
Note: you might need to `chmod +x homebrewupdate.sh`
#!/usr/bin/env python
# Linux usage: ./extract_tampermonkey_script.py "/home/<USER>/.config/<BROWSER>/Default/Local Extension Settings/<EXTENSION_ID>"
# i.e.: ./extract_tampermonkey_script.py "/home/foo/.config/google-chrome-beta/Default/Local Extension Settings/gcalenpjmijncebpfijmoaglllgpjagf"
# Mac usage: ./extract_tampermonkey_script.py "/Users/<USER>/Library/Application Support/Google/Chrome/Default/Local Extension Settings/<EXTENSION_ID>/"
# i.e.: ./extract_tampermonkey_script.py "/Users/foo/Library/Application Support/Google/Chrome/Default/Local Extension Settings/dhdgffkkebhmkfjojejmpbldmpobfkfo/"
import leveldb
import sys
import re
@creamidea
creamidea / menu.lst
Created March 31, 2016 06:15 — forked from poppen/menu.lst
menu.lst of grub4dos for booting iso images from usb drive
# This is a sample menu.lst file. You should make some changes to it.
# The old install method of booting via the stage-files has been removed.
# Please install GRLDR boot strap code to MBR with the bootlace.com
# utility under DOS/Win9x or Linux.
color white/light-blue yellow/cyan light-gray/magenta white/light-red
title Acronis True Image Home
find --set-root /atih.iso
map /atih.iso (0xff) || map --mem /atih.iso (0xff)
@creamidea
creamidea / deep_extend_javascript_objects_underscore_mixin.js
Created January 28, 2016 05:05 — forked from kurtmilam/deep_extend_javascript_objects_underscore_mixin.js
Deep Extend / Merge Javascript Objects - underscore.js Mixin
/* Copyright (C) 2012-2014 Kurt Milam - http://xioup.com | Source: https://gist.github.com/1868955
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TO
### BEGIN /etc/grub.d/05_debian_theme ###
insmod part_msdos
insmod ext2
set root='(hd0,msdos5)'
search --no-floppy --fs-uuid --set cd4b8d8b-3265-4fa6-b8a6-9b3b74d9f849
insmod png
if background_image /share/images/desktop-base/spacefun-grub.png; then
set color_normal=light-gray/black
set color_highlight=white/black
else
#!/usr/bin/env python
__copyright__ = 'Yuanxuan Wang <zellux at gmail dot com>'
from calibre.web.feeds.news import BasicNewsRecipe
from calibre.ebooks.BeautifulSoup import Tag, NavigableString
from collections import OrderedDict
from contextlib import nested, closing
import json

https://github.com/mustache/emacs

In your shell:

cd ~/.emacs.d/vendor
curl -O https://github.com/mustache/emacs/raw/master/mustache-mode.el

In your Emacs config:

(add-to-list 'load-path "~/.emacs.d/vendor/mustache-mode.el")

@creamidea
creamidea / convert.sh
Created September 26, 2013 03:21 — forked from wilmoore/convert.sh
#!/bin/bash
FILES=`find -iname *.txt -print`
for FILE in $FILES
do
# replace the + to # chars
sed -i -r 's/^([+]{4})\s/#### /' $FILE
sed -i -r 's/^([+]{3})\s/### /' $FILE
sed -i -r 's/^([+]{2})\s/## /' $FILE
sed -i -r 's/^([+]{1})\s/# /' $FILE
sed -i -r 's/(\[php\])/<?php/' $FILE