Skip to content

Instantly share code, notes, and snippets.

<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
<channel>
<title>Hacker News TL;DR 💯</title>
<link>https://news.ycombinator.com/newest</link>
<description>
<![CDATA[Hacker News TL;DR RSS feed with 💯+ points]]>
</description>
<generator>HN TL;DR v0.0.2</generator>
<lastBuildDate>Thu, 30 May 2024 02:05:28 +0000</lastBuildDate>
@zfz
zfz / diff_json.md
Last active January 12, 2021 21:49 — forked from ipan/diff-jq.md
compare two JSONs with jq #json #jq
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
@zfz
zfz / jump.py
Last active February 18, 2019 21:16
class Solution(object):
def solution(self, A):
n = len(A)
res = [n-1] # last element is counted
even = {n-1: True, None: False}
odd = {n-1: True, None: False}
def check_pos(i, flag):
if flag % 2:
if i in odd:
> const _ = require('lodash');
> obj = {'a': {'b': [1,2,3]}}
{ a: { b: [ 1, 2, 3 ] } }
> obj1 = _.cloneDeep(obj);
{ a: { b: [ 1, 2, 3 ] } }
> obj1.a.b.push(4)
@zfz
zfz / mongo-service
Created September 25, 2018 16:02
MongoDB service scripts and configurations
#!/bin/bash
MONGO_CONFIG=/vagrant/Applications/mongodb-linux/scripts/mongod.conf.yaml
MONGO_DB_PATH=/home/vagrant/Data/mongo
# Mongo start and stop
function start_mongo() {
mongod --config ${MONGO_CONFIG}
}
@zfz
zfz / curl_info.sh
Last active November 2, 2017 06:19
curl wttr.in/beijing
curl ipinfo.io/8.8.8.8
curl ipinfo.io/ip
curl ipinfo.io
# Insert your preferred key mappings here.
map <c-h> goBack
map <c-l> goForward
map <c-j> previousTab
map <c-k> nextTab
map <c-d> removeTab
# Proxy switch to ShadowSocksX-NG
function set_proxy() {
export {http,https,ftp}_proxy='127.0.0.1:1087'
}
function unset_proxy() {
unset {http,https,ftp}_proxy
}
import os
import sys
import time
def detached(f):
"""Generator for creating a forked process
from a function"""
def wrapper(*args, **kwargs):
"""Wrapper function to be returned from generator.