Skip to content

Instantly share code, notes, and snippets.

View xdimh's full-sized avatar
🎯
Focusing

~Refresh xdimh

🎯
Focusing
View GitHub Profile
@sweet-zone
sweet-zone / jumpjump.js
Created January 1, 2018 15:16
跳一跳刷分 Nodejs 版
const crypto = require('crypto')
const axios = require('axios')
const url = 'https://mp.weixin.qq.com/wxagame/wxagame_settlement'
const sessionId = 'your session id'
function getActionData(key, content, iv) {
const clearEncoding = 'utf8'
const cipherEncoding = 'base64'
let cipherChunks = []
@iffy
iffy / .gitignore
Last active January 8, 2025 06:32
Example using electron-updater with `generic` provider.
node_modules
dist/
yarn.lock
wwwroot
@zz85
zz85 / otsu.js
Last active February 4, 2022 18:31
Otsu's method - Automatic Histogram Based Image Thresholding
// Read https://en.wikipedia.org/wiki/Otsu%27s_method (added this since JS examples in wikipedia didn't work)
function otsu(histData /* Array of 256 greyscale values */, total /* Total number of pixels */) {
let sum = 0;
for (let t=0 ; t<256 ; t++) sum += t * histData[t];
let sumB = 0;
let wB = 0;
let wF = 0;
@parmentf
parmentf / GitCommitEmoji.md
Last active April 6, 2025 00:16
Git Commit message Emoji
@starfalling
starfalling / osx_dmg_package
Last active April 5, 2022 09:55
mac osx 程序自动打包为 dmg 文件的脚本
set -e
title='千尋影視' # dmg 文件 mount 了之后在文件系统中显示的名称
background_picture_name='mac-dmg-bg.png' # dmg 文件在 mount 了之后界面中显示的背景图片路径
application_name='千尋影視.app' # 应用程序的名称
# Developer ID 证书的名称(名字的一部分即可,但是需要能在 Keychain Access 中唯一定位到该证书)
developer_id='Developer ID Application: Shanghai Truecolor Multimedia'
# dmg 窗口相关的一些设置,需要根据实际情况做变更
window_left=200 # 窗口位置的 x 坐标
@monteslu
monteslu / serialport.js
Last active December 19, 2018 09:05
chrome serial port implementation for node serialport
/*global chrome*/
var EventEmitter = require('./events.js').EventEmitter;
var util = require('./util.js');
function SerialPort(port, options) {
var self = this;
var id;
var bytesToRead = options.buffersize || 1;
@fragje
fragje / my.cnf
Created April 3, 2014 13:07
Custom my.cnf for use with MAMP. Place this file in `/Application/MAMP/conf/` and restart MAMP
# Example MySQL config file for large systems.
#
# This is for a large system with memory = 512M where the system runs mainly
# MySQL.
#
# MySQL programs look for option files in a set of
# locations which depend on the deployment platform.
# You can copy this option file to one of those
# locations. For information about these locations, see:
# http://dev.mysql.com/doc/mysql/en/option-files.html
@gitaarik
gitaarik / git_submodules.md
Last active April 4, 2025 20:30
Git Submodules basic explanation

Git Submodules basic explanation

Why submodules?

In Git you can add a submodule to a repository. This is basically a repository embedded in your main repository. This can be very useful. A couple of usecases of submodules:

  • Separate big codebases into multiple repositories.
@vukicevic
vukicevic / Draw Bitmap From Int Array
Last active October 31, 2023 08:50
Generate a monochrome bitmap image in JavaScript using a byte-array. The image is generated such that every bit in the array is shown as either a black (1) or white (0) pixel.
/**
* depth: 1 - monochrome
* 4 - 4-bit grayscale
* 8 - 8-bit grayscale
* 16 - 16-bit colour
* 32 - 32-bit colour
**/
function drawArray(arr, depth) {
var offset, height, data, image;
@luckydrq
luckydrq / connect.js
Last active December 21, 2015 05:09
Connect源码解析
var EventEmitter = require('events').EventEmitter
, proto = require('./proto')
, utils = require('./utils')
, path = require('path')
, basename = path.basename
, fs = require('fs');
//应用补丁,封装了一些方法
require('./patch');