Skip to content

Instantly share code, notes, and snippets.

@adioshun
adioshun / centroidtracker.py
Created August 13, 2018 05:51
Simple object tracking with OpenCV
# https://www.pyimagesearch.com/2018/07/23/simple-object-tracking-with-opencv/
# import the necessary packages
from scipy.spatial import distance as dist
from collections import OrderedDict
import numpy as np
class CentroidTracker():
def __init__(self, maxDisappeared=50):
# initialize the next unique object ID along with two ordered
@JcBernack
JcBernack / BigDecimal.cs
Last active April 29, 2024 09:20
BigDecimal
using System;
using System.Numerics;
namespace Common
{
/// <summary>
/// Arbitrary precision decimal.
/// All operations are exact, except for division. Division never determines more digits than the given precision.
/// Source: https://gist.github.com/JcBernack/0b4eef59ca97ee931a2f45542b9ff06d
/// Based on https://stackoverflow.com/a/4524254
@vasanthk
vasanthk / System Design.md
Last active April 29, 2024 09:18
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@bcye
bcye / README.md
Last active April 29, 2024 09:18
Make ics events recurring

ETH myStudies ics Script

This script is intended to be used with the ics files outputted by myStudies, to make importing your schedule into your calendar easier.

myStudies does not export recurring events, but instead individual events for every date. This makes it hard if you want to edit them, because you can't edit them as a series.

Usage

Call this script with these arguments:

  1. input ics file
  2. output ics file name
  3. start date of events to be considered (choose exactly one week, all events in the given timeframe will be kept with the added weekly recurrence rule)
@awkale
awkale / css-order.md
Last active April 29, 2024 09:18
#CSS Declaration order

css property order

Related property declarations should be grouped together following the order:

  1. Positioning
  • position
  • top
  • right
  • bottom
  • left
  • z-index
@throwaway96
throwaway96 / crashd.md
Last active April 29, 2024 09:13
crashd instructions

News

New exploit for webOS 3.5+: DejaVuln (2024-04-21)

See dejavuln-autoroot for a simpler exploit that works on webOS 3.5+ TVs (i.e., models from 2017 and later). It is unpatched as of 2024-04-21 and does not require Developer Mode or even a network connection—just a USB drive.

Otherwise:

  • If you have a webOS 5–8 TV with old enough firmware, WTA (which does not require Dev Mode) will still work.
  • If you have a webOS 4.x TV, you can also try CVE-2023-6319, which is unpatched on the latest (final?) firmware for webOS 4.0 (2018) models.
  • While there will eventually be fully software-based exploits released for older models, they can currently be rooted via NVM.
@eduardo-matos
eduardo-matos / rabbit-graceful-shutdown.js
Last active April 29, 2024 09:13
RabbitMQ graceful shutdown in NodeJS
const amqp = require('amqplib');
const uuid = require('uuid')
const CONSUMER_TAG = uuid.v4();
const QUEUE_NAME = 'my_queue'
async function main() {
const conn = await amqp.connect('amqp://guest:guest@localhost:5672/%2F');
const channel = await conn.createChannel();
await channel.assertQueue(QUEUE_NAME);
@baymaxium
baymaxium / content.md
Created October 18, 2017 08:31
闲扯比特币套利交易系统的设计

原文:程序人生

关于比特币套利交易的文章,坊间一搜一大堆,尤以 2014,2015 为甚。那时交易所间价差相当可观,套利的机会很多,躺着赚钱并非难事。如今,套利区间收窄,留在沙场上的估计只剩下大玩家,想要不费力气躺赢机会渺茫。最近帮朋友牵线寻找币圈量化交易的机会,本欲做个打酱油的中间人,事了拂衣去,安安静静做个三河市微胖界扛把子,谁料还是一时技痒,不小心昨夜搭进去六七个小时。

关于如何做套利交易,我就不赘述,大家可以看这篇文章,有内容有故事:https://daily.zhihu.com/story/4831821。

本文没有故事,只有技术和产品上的分析。

既然要做可行性分析,那么第一步就是观察交易数据。国内的交易市场虽然在政策要求下清场出局,国外的交易市场还算红火。从 bitfinex,kraken 一路到 bithumb,korbit 等,都提供 rest API,少量提供 websocket 接口。虽然文档欠缺,但这些接口都很简单,上手并不困难。

@sataniceypz
sataniceypz / alive.js
Last active April 29, 2024 09:12 — forked from Kingbadan321/alive.js
Custom Alive For Izumi-xd
const { command, isPrivate, getBuffer } = require("../lib/");
const config = require("../config");
// Edit here 👇🏿🌸
let title = "𝗜𝗭𝗨𝗠𝗜-𝗫𝗗"
let body = "𝗛𝗲𝘆 𝗜𝘇𝘂𝗺𝗶 𝗶𝘀 𝗔𝗹𝗶𝘃𝗲🧚‍♂️"
let sourceUrl = "github.com/sataniceypz/Izumi-v2"
let mediaUrl = "github.com/sataniceypz/Izumi-v2"
let mediaType = 1
@simme
simme / Install_tmux
Created October 19, 2011 07:55
Install and configure tmux on Mac OS X
# First install tmux
brew install tmux
# For mouse support (for switching panes and windows)
# Only needed if you are using Terminal.app (iTerm has mouse support)
Install http://www.culater.net/software/SIMBL/SIMBL.php
Then install https://bitheap.org/mouseterm/
# More on mouse support http://floriancrouzat.net/2010/07/run-tmux-with-mouse-support-in-mac-os-x-terminal-app/