Skip to content

Instantly share code, notes, and snippets.

View cczhong11's full-sized avatar
😆

tianchen zhong cczhong11

😆
View GitHub Profile
# src/simulation/controller/CMakeLists.txt
cmake_minimum_required(VERSION 3.5)
project(controller)
# Default to C99
if(NOT CMAKE_C_STANDARD)
set(CMAKE_C_STANDARD 99)
endif()
# Default to C++14
from md2pdf.core import md2pdf
import requests
from bs4 import BeautifulSoup
from typing import List
import json
import time
from web_util import parse_curl
headers = {}
with open("CURL") as f:
_, headers = parse_curl(f.read())
@cczhong11
cczhong11 / backup_dir.py
Last active January 20, 2021 05:09
backup dir
import os
import click
import datetime
import sys
DURATION = 24*3600
DEBUG = False
now = datetime.datetime.now().timestamp()
def check_time(timestamp, duration):
return (now - timestamp)<duration
function myFunction() {
// add to ui
var ui = SpreadsheetApp.getUi();
ui.createMenu("Sync to Calendar")
.addItem("Schedule life", "schedule")
.addToUi();
}
function schedule() {
var eventCal = CalendarApp.getCalendarById(xxxxxxx);
var spreadsheet = SpreadsheetApp.getActiveSheet();

maven 1.5 upgrade problem

<properties>
    <maven.compiler.source>1.6</maven.compiler.source>
    <maven.compiler.target>1.6</maven.compiler.target>
  </properties>
// ==UserScript==
// @name One-click to add all people
// @namespace ztc
// @description one-click to log down people I want to know
// @include https://www.linkedin.com/search/*
// @version 0.4
// @grant GM_setClipboard
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAA3NCSVQICAjb4U/gAAAACXBIWXMAAAsSAAALEgHS3X78AAAAFXRFWHRDcmVhdGlvbiBUaW1lADYvMjQvMDn2wWvjAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M0BrLToAAAAY9QTFRFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWJ+8Upq2DFJ4BklsVJu4CU1zCU5zTpWyV5+7DlN4B0twB0tvCU50C1mEC1+NDFF3DGWWDmSRD2iYEFV5EmuaE1d7FGeTFVp9FWGKFW2cGFyAGHCeGmCDG3OgHWKFHnWiIGSHIXikI2iLJHumJmuNKG6PKH2oK3CSK4CrLnSVLoOtL2iDMHaXMYavM3maNHOQNIixNXaUNnycN4uzOX6eOX+fOo21O3SLPIKiPY2yPY2zPZC3PoqtP4WkP42xQJO5QoinQ5W7RYuqRpi9SIOfSI+sSZu/S5KvS5OwTJ3BTpe6T6DDUYGXUpq2UqPFVZy5VabHV566WKjJWafHW4eaW6vLXaHAYa7NYqC+Yq3MY6LBZ6K9aq7Kbq3Hc7LMdJindbjTgbTLhL/VicDXi6u5j8TZornErL7GuMbNxdDVy9ng1dzg19fX2tra3Nzc3ODh3t7e5ubm6Ojo6urq7e3t7+/v8fHx9PT09vb2+fn5+/v7/f39/////8EcrgAAA
@cczhong11
cczhong11 / leetcodeAdd.js
Last active August 6, 2018 15:23
js script to help me do some checking in leetcode
// ==UserScript==
// @name leetcode notification
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://leetcode.com/*
// @grant none
// ==/UserScript==
@cczhong11
cczhong11 / changeTZ.java
Created July 9, 2018 19:15
change timezone in java
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy HH:mm:ss");
ZonedDateTime start_time = LocalDateTime.parse(p.getStart_time(), formatter).atZone(ZoneId.of("America/Chicago"));
start_time.format(DateTimeFormatter.ISO_INSTANT).toString()
@cczhong11
cczhong11 / docker.md
Last active September 10, 2018 14:11
docker common command

Docker basic method

Dockerfile

  • FROM: pull basic image
  • VOLUME: create a mount point
  • ARG : set arg when build it docker build --build-arg some_variable_name=a_value
  • RUN : run command before start
  • COPY : copy local file to container
  • ENV : env path
  • CMD : run command in the beginning. only one effect https://vsupalov.com/docker-env-vars/
/***************************************************************************
* A Linked List class with a private static inner Node class.
* source: https://www.cs.cmu.edu/~adamchik/15-121/lectures/Linked%20Lists/code/LinkedList.java
*****************************************************************************/
import java.util.*;
public class LinkedList<AnyType> implements Iterable<AnyType>
{
private Node<AnyType> head;