Skip to content

Instantly share code, notes, and snippets.

View easychen's full-sized avatar
❄️
休息,休息一会儿

Easy easychen

❄️
休息,休息一会儿
View GitHub Profile
@mokjpn
mokjpn / M5StackViewImagebyURL.py
Last active July 21, 2022 03:26
M5Stack sample code: Download a JPEG image from given URL, then display it on LCD.
from m5stack import lcd
import socket
import os
def split_list(l, s):
count = 0
ni = []
for i in range(0, len(l)-len(s)):
if l[i] == s[count]:
count=count+1
@raineorshine
raineorshine / sendRawTransaction.js
Last active December 3, 2022 18:02
Sends a raw transaction with web3 v1.2.2, ethereumjs-tx v2.1.1, and Infura
const Web3 = require('web3')
const Tx = require('ethereumjs-tx').Transaction
// connect to Infura node
const web3 = new Web3(new Web3.providers.HttpProvider('https://mainnet.infura.io/INFURA_KEY'))
// the address that will send the test transaction
const addressFrom = '0x1889EF49cDBaad420EB4D6f04066CA4093088Bbd'
const privateKey = new Buffer('PRIVATE_KEY', 'hex')
@breezewish
breezewish / biaori-to-anki.js
Last active March 21, 2024 01:09
将《新标准日语》的音频和单词导入到 Anki https://zhuanlan.zhihu.com/p/58139619
const assert = require("assert").strict;
const child_process = require("child_process");
const path = require("path");
const crypto = require("crypto");
const glob = require("glob");
const fs = require("fs-extra");
const _ = require("lodash");
const sort = require("alphanum-sort");
const Kuroshiro = require("kuroshiro");
const KuromojiAnalyzer = require("kuroshiro-analyzer-kuromoji");
@shayanb
shayanb / eventListener.js
Created September 15, 2016 22:26
simple NodeJS app to display triggered events on a smart contract
// This is a simple NodeJS app to display triggered events on a smart contract
// you need your contract ABI and deployed address and also a synced geth running
// github.com/shayanb
var optionsABI = [YOUR_CONTRACT_ABI]
var contractAddress = "0xYOUR_CONTRACT_ADDRESS"
var Web3 = require('web3');
@savvot
savvot / ffmpeg-extract-keyframes.sh
Last active February 3, 2022 06:40
Extract only keyframes (I-frames) from video to images with console ffmpeg
ffmpeg -ss <start_time> -i video.mp4 -t <duration> -q:v 2 -vf select="eq(pict_type\,PICT_TYPE_I)" -vsync 0 frame%03d.jpg
This file has been truncated, but you can view the full file.
阿爸 a1'ba4 18137
阿昌族 a1'chang1'zu2 50849
阿斗 a1'dou3 42632
阿飞 a1'fei1 48603
阿富汗 a1'fu4'han4 3461
阿訇 a1'hong1 34432
阿拉伯数字 a1'la1'bo2'shu4'zi4 35937
阿拉伯语 a1'la1'bo2'yu3 30476
阿妈 a1'ma1 16220
阿门 a1'men2 47913
@mscdex
mscdex / test.js
Last active September 15, 2023 11:55
sharing sessions between node.js and php using redis
var express = require('express'),
app = express(),
cookieParser = require('cookie-parser'),
session = require('express-session'),
RedisStore = require('connect-redis')(session);
app.use(express.static(__dirname + '/public'));
app.use(function(req, res, next) {
if (~req.url.indexOf('favicon'))
return res.send(404);
@keo
keo / bootstrap.sh
Last active January 25, 2024 15:49
Setup encrypted partition for Docker containers
#!/bin/sh
# Setup encrypted disk image
# For Ubuntu 14.04 LTS
CRYPTFS_ROOT=/cryptfs
apt-get update
apt-get -y upgrade
apt-get -y install cryptsetup
@ndarville
ndarville / webm.md
Last active September 30, 2023 18:56
4chan’s guide to converting GIF to WebM - https://boards.4chan.org/g/res/41212767

Grab ffmpeg from https://www.ffmpeg.org/download.html

It's a command line tool which means you will have to type things with your keyboard instead of clicking on buttons.

The most trivial operation would be converting gifs:

ffmpeg -i your_gif.gif -c:v libvpx -crf 12 -b:v 500K output.webm
  • -crf values can go from 4 to 63. Lower values mean better quality.
  • -b:v is the maximum allowed bitrate. Higher means better quality.
@denvis
denvis / gist:8802605
Created February 4, 2014 12:17
git version tag file hook
Version file hook
normal repo
cd .git/hooks
nano pre-commit
#!/bin/sh
git describe --always --tag > version.txt