Skip to content

Instantly share code, notes, and snippets.

@pissang
pissang / ts-type-guide.md
Last active May 10, 2024 08:45
TypeScript 类型编写指南

TypeScript 类型编写指南

前言

本文主要作为平时在 TypeScript 代码中编写类型以及对 TypeScript 代码进行 review 时候的参考手册,并非强制执行的规范,也不涉及纯代码风格以及代码逻辑上的指导。

前置阅读

本文内容参考了下面几个手册,所以强烈建议能够同时阅读完这几个手册。如果大家对 TypeScript 的一些基础用法和特性还不熟悉,也建议先阅读第一个 TypeScript 手册。

@jschaf
jschaf / scratch_server.go
Created March 12, 2019 07:40
A Go web server from scratch using syscalls
package main
// Simple, single-threaded server using system calls instead of the net library.
//
// Omitted features from the go net package:
//
// - TLS
// - Most error checking
// - Only supports bodies that close, no persistent or chunked connections
// - Redirects
@JoaoCarabetta
JoaoCarabetta / xml_to_csv.py
Last active May 10, 2024 08:41
Three lines to convert xml to csv
import xmltodict
import pandas as pd
import requests
xml = request.get('url').text
df = pd.DataFrame(xmltodict.parse(xml))
df.rename(columns=lambda x: x.replace('@', ''), inplace=True)
df.to_csv('data.csv')
@STiXzoOR
STiXzoOR / TeamViewer-15-id-changer-for-mac.py
Last active May 10, 2024 08:37 — forked from 0x2a94b5/TeamViewer-15-id-changer-for-mac.py
Teamviewer 15 ID Changer for macOS (Python 3)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# System: macOS 12+
# Version: TeamViewer v15.x.x
# Python: 3.x.x
# Command: sudo python TeamViewer-15-id-changer.py
#
import os
@ebuildy
ebuildy / index.py
Last active May 10, 2024 08:34
List gitlab container registry size, per project, via gitlab API
import gitlab
import urllib3
import humanfriendly
import timeago, datetime
# 2020-04-24T12:04:26.475+00:00
date_now = datetime.datetime.now()
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
@simondiep
simondiep / create-org-repo-via-github-app.md
Last active May 10, 2024 08:34
Steps to automate the creation of repos as a github app without needing user credentials
  1. Create a Github App (Organization > Settings > Developer Settings > Github Apps). This name will be publicly visible and any repo invites will show this name in the invite email.
  2. Set the permissions to read/write for repository administration and repository contents.
  3. Install the Github App for your organization (Github App > Install App)
  4. Generate a private key for your Github App
  5. Copy the Ruby Script to generate a JWT from your private key https://developer.github.com/apps/building-github-apps/authentication-options-for-github-apps/
require 'openssl'
require 'jwt' # https://rubygems.org/gems/jwt
@JBlond
JBlond / bash-colors.md
Last active May 10, 2024 08:31 — forked from iamnewton/bash-colors.md
The entire table of ANSI color codes.

Regular Colors

Value Color
\e[0;30m Black
\e[0;31m Red
\e[0;32m Green
\e[0;33m Yellow
\e[0;34m Blue
\e[0;35m Purple
@realvjy
realvjy / ChoasLinesShader.metal
Last active May 10, 2024 08:31
Choas Lines - Metal Shader
// Lines
float hash( float n ) {
return fract(sin(n)*753.5453123);
}
// Slight modification of iq's noise function.
float noise(vector_float2 x )
{
vector_float2 p = floor(x);
vector_float2 f = fract(x);
@real-jiakai
real-jiakai / ssh-snippets.md
Last active May 10, 2024 08:31
ssh工具代码脚本片段

1、debian、ubuntu更新并升级软件包

apt update && apt upgrade -y

2、docker compose重新部署

docker compose down && docker compose up -d
@nikAizuddin
nikAizuddin / Podman Installation on OpenSUSE Tumbleweed WSL2.md
Created February 25, 2023 05:56
Podman Installation on OpenSUSE Tumbleweed WSL2

Podman Installation on OpenSUSE Tumbleweed WSL2

Make sure all packages up-to-date:

sudo zypper dup

Restart OpenSUSE by executing the following command using Powershell:

wsl --shutdown openSUSE-Tumbleweed