Skip to content

Instantly share code, notes, and snippets.

@sharmaeklavya2
sharmaeklavya2 / cp_syllabus.md
Last active March 29, 2024 12:24
Competitive Programming Syllabus

Competitive Programming Syllabus

Geometry

  • Problems - Refer the article for a list of problems which can be solved using Rotating Calipers technique.
@InToSSH
InToSSH / esphome_venetian_blind.yaml
Last active March 29, 2024 12:22
ESPHome - Venetian Blind example with time-based cover control and tilt with Shelly2.5
# This is an example yaml config file for ESPHome to control Venetian blinds with one motor, where turning on the motor in 'up' direction first fully tilts open the blind then starts moving up, and vice versa, in 'down' direction first tilts blind closed, then starts moving down.
# AUTHOR: InToSSH - github.com/InToSSH
substitutions:
device_name: Living Room Cover
esphome:
name: living_room_blind
platform: ESP8266
board: esp01_1m
using UnityEngine;
namespace Cham
{
/// <summary>
/// ソフトウェアキーボードの表示領域を管理するクラス
/// </summary>
public static class SoftwareKeyboaryArea
{
/// <summary>
@luochen1990
luochen1990 / venv-py37.nix
Last active March 29, 2024 12:18
Nix Script to simulate FHS environment with python3 & pip & venv
#!/usr/bin/env -S bash -c 'nix-shell --pure $0 -A env'
# Usage:
# 1. run directly to enter bash (inside venv): `./venv-py37.nix`
# 2. build a standalone executable: `nix bundle -f ./venv-py37.nix` #this not works yet since it cause nested `unshare -U` call
# 3. run bash with extra arguments: `nix run -f ./venv-py37.nix '' -- -c 'python --version'`
# More:
# 1. commit id of nixpkgs can be found here: https://lazamar.co.uk/nix-versions/?channel=nixpkgs-unstable&package=python3
let
@hallazzang
hallazzang / main.go
Last active March 29, 2024 12:12
[go] (Windows) ensure all child processes are killed when main program exits
package main
import (
"os/exec"
"unsafe"
"golang.org/x/sys/windows"
)
// We use this struct to retreive process handle(which is unexported)
@vratiu
vratiu / .bash_aliases
Last active March 29, 2024 12:11
Git shell coloring
# Customize BASH PS1 prompt to show current GIT repository and branch.
# by Mike Stewart - http://MediaDoneRight.com
# SETUP CONSTANTS
# Bunch-o-predefined colors. Makes reading code easier than escape sequences.
# I don't remember where I found this. o_O
# Reset
Color_Off="\[\033[0m\]" # Text Reset
@asci
asci / fetchHighlightsFromAppleBooks.js
Last active March 29, 2024 12:08
Export Highlights from Apple Books
const fs = require("fs");
const sqlite3 = require("sqlite3");
const glob = require("glob");
const os = require("os");
const { open } = require("sqlite");
const username = os.userInfo().username;
const ANNOTATION_DB_PATH = `/users/${username}/Library/Containers/com.apple.iBooksX/Data/Documents/AEAnnotation/`;
const BOOK_DB_PATH = `/users/${username}/Library/Containers/com.apple.iBooksX/Data/Documents/BKLibrary/`;
const annotationsFiles = glob.sync(`${ANNOTATION_DB_PATH}/*.sqlite`);
@ih2502mk
ih2502mk / list.md
Last active March 29, 2024 12:07
Quantopian Lectures Saved
@leilee
leilee / UIView+GradientBorder.swift
Last active March 29, 2024 12:05
Add gradient border to UIView
public extension UIView {
private static let kLayerNameGradientBorder = "GradientBorderLayer"
public func setGradientBorder(
width: CGFloat,
colors: [UIColor],
startPoint: CGPoint = CGPoint(x: 0.5, y: 0),
endPoint: CGPoint = CGPoint(x: 0.5, y: 1)
) {