Skip to content

Instantly share code, notes, and snippets.

View staticor's full-sized avatar

SteveYagn staticor

View GitHub Profile
@fancellu
fancellu / ConsumerExample.scala
Last active June 28, 2023 15:35
Kafka Producer/Consumer Example in Scala
import java.util
import org.apache.kafka.clients.consumer.KafkaConsumer
import scala.collection.JavaConverters._
object ConsumerExample extends App {
import java.util.Properties
@ryandavidhartman
ryandavidhartman / BasicKafkaProcducer.scala
Last active June 10, 2021 12:39
A demonstration of the simplest Scala Kafka Producer
package com.example.basic
import java.util.Properties
import org.apache.kafka.clients.producer.{Callback, RecordMetadata, ProducerRecord, KafkaProducer}
import scala.concurrent.Promise
case class BasicProducer(topic: String, brokerList:String, sync: Boolean) {
val kafkaProps = new Properties()
@lucifr
lucifr / wubi_pinyin.emoji.dict.yaml
Last active March 18, 2021 16:45
Wubi Pinyin Extended Dictionary(emoji) for Rime
# Rime dictionary
# encoding: utf-8
#
# Wubi Pinyin Extended Dictionary(emoji) - 五笔拼音擴充詞庫(表情)
#
# by @lucifr
# based on https://gist.github.com/lembacon/4593540 & http://www.jianshu.com/p/ef2d9442fb0c
#
# 部署位置:
# ~/.config/ibus/rime (Linux)
@TheBB
TheBB / loading.org
Last active June 22, 2023 11:53
Loading in Spacemacs

Emacs packages, features, files, layers, extensions, auto-loading, require, provide, use-package… All these terms getting you confused? Let’s clear up a few things.

Files

Emacs files contains code that can be evaluated. When evaluated, the functions, macros and modes defined in that file become available to the current Emacs session. Henceforth, this will be termed as loading a file.

One major problem is to ensure that all the correct files are loaded, and in the

@creeek
creeek / default.custom.yaml
Created April 20, 2015 06:30
Custom RIME
# ~/Library/Rime/default.custom.yaml
patch:
menu/page_size: 5
recognizer/patterns/yuncheng123: "^yuncheng[0-9]+$"
recognizer/patterns/yunchengime: "^yuncheng[-_.0-9]*$"
recognizer/patterns/xiang123: "^xiang[0-9]+$"
recognizer/patterns/xiangime: "^xiang[-_.0-9]*$"
recognizer/patterns/xuxiang123: "^xuxiang[0-9]+$"
recognizer/patterns/xuxiangime: "^xuxiang[-_.0-9]*$"
@goxofy
goxofy / Karabiner_Private_For_Filco_Minila.xml
Last active April 23, 2024 09:19
Karabiner 备份 For Filco Minila
<?xml version="1.0"?>
<root>
<!-- 设备定义 -->
<devicevendordef>
<vendorname>FILCO</vendorname>
<vendorid>0x0a5c</vendorid>
</devicevendordef>
<deviceproductdef>
<productname>MINILA_KEYBOARD</productname>
@JinnLynn
JinnLynn / taobao.py
Last active September 16, 2020 03:03
淘宝消费情况统计
# -*- coding: utf-8 -*-
"""淘宝消费情况统计
使用方法:
python taobao.py -u USERNAME -p PASSWORD -s START-DATE -e END-DATE --verbose
所有参数均可选,如:
python taobao.py -u jinnlynn
统计用户jinnlynn所有订单的情况
@jcouyang
jcouyang / why-curry-helps.md
Last active February 20, 2023 21:09
为什么要柯里化(why-curry-helps)slide http://git.io/why-curry-helps 📈

还记得 Haskell Curry吗,

多巧啊, 人家姓 Curry 名 Haskell, 难怪 Haskell 语言会自动柯里化, 呵呵. 但是不奇怪吗, 为什么要柯里化呢. 为什么如此重要导致 Haskell 会默认自动柯里化所有函数, 不就是返回一个部分配置好的函数吗.

我们来看一个 Haskell 的代码.

max 3 4
(max 3) 4
@lotem
lotem / active.md
Created December 27, 2013 13:09 — forked from paulmillr/active.md

Most active GitHub users (git.io/top)

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Sat, 22 Dec 2012 23:34:58 GMT till Sun, 22 Dec 2013 23:34:58 GMT.

Only first 1000 GitHub users according to the count of followers are taken. This is because of limitations of GitHub search. Sorting algo in pseudocode:

githubUsers
 .filter((user) -&gt; user.followers &gt; 229)
@zhangw
zhangw / bankcard_check.js
Created November 8, 2013 06:18
银行卡号Luhm校验算法
//Description: 银行卡号Luhm校验算法
//Luhm校验规则:16位银行卡号(19位通用):
// 1.将未带校验位的 15(或18)位卡号从右依次编号 1 到 15(18),位于奇数位号上的数字乘以 2。
// 2.将奇位乘积的个十位全部相加,再加上所有偶数位上的数字。
// 3.将加法和加上校验位能被 10 整除。
  //bankno位银行卡号
function luhmCheck(bankno){