Skip to content

Instantly share code, notes, and snippets.

@matt2005
matt2005 / lambda_function.py
Last active May 2, 2024 07:29 — forked from awarecan/lambda_function.py
Alexa Smart Home Skill Adapter for Home Assistant
"""
Copyright 2019 Jason Hu <awaregit at gmail.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@fnky
fnky / ANSI.md
Last active May 2, 2024 07:28
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@itsmikita
itsmikita / README.md
Last active May 2, 2024 07:27
Create bootable USB drive from InstallMacOSX.pkg

Create bootable USB drive from InstallMacOSX.pkg

  1. Erase USB drive with Disk Utility using format Mac OS Extended (Journaled) and Master Boot Record and call it MyVolume
  2. Use Finder to mount/open InstallMacOSX.dmg.
  3. Run following commands:
pkgutil --expand /Volumes/Install\ OS\ X/InstallMacOSX.pkg /tmp/El\ Capitan
diskutil eject Install\ OS\ X
cd /tmp/El\ Capitan
@taoyuan
taoyuan / generate_self_signed_certification.md
Last active May 2, 2024 07:26
Generation of a Self Signed Certificate

Generation of a Self Signed Certificate

Generation of a self-signed SSL certificate involves a simple 3-step procedure:

STEP 1: Create the server private key

openssl genrsa -out cert.key 2048

STEP 2: Create the certificate signing request (CSR)

openssl req -new -key cert.key -out cert.csr
@y0ngb1n
y0ngb1n / docker-registry-mirrors.md
Last active May 2, 2024 07:25
国内的 Docker Hub 镜像加速器,由国内教育机构与各大云服务商提供的镜像加速服务 | Dockerized 实践 https://github.com/y0ngb1n/dockerized

Docker Hub 镜像加速器

国内从 Docker Hub 拉取镜像有时会遇到困难,此时可以配置镜像加速器。Docker 官方和国内很多云服务商都提供了国内加速器服务。

Dockerized 实践 https://github.com/y0ngb1n/dockerized

配置加速地址

Ubuntu 16.04+、Debian 8+、CentOS 7+

@xirixiz
xirixiz / Set up GitHub push with SSH keys.md
Last active May 2, 2024 07:26 — forked from developius/README.md
Set up GitHub push with SSH keys

SSH keypair setup for GitHub (or GitHub/GitLab/BitBucket, etc, etc)

Create a repo.

Make sure there is at least one file in it (even just the README.md)

Generate a SSH key pair (private/public):

ssh-keygen -t rsa -C "your_email@example.com"
@matthewaveryusa
matthewaveryusa / grab_io_kbm.c
Created May 20, 2016 03:13
linux grab io from keyboard and mouse
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <linux/input.h>
#include <time.h>
#include <stdint.h>
int main(int argc, char* argv[]){
sleep(1);
@afspies
afspies / gpu_allocation.py
Last active May 2, 2024 07:20
Automatic GPU Allocation
# EDIT 10/04/2022 - This version was provided by @jayelm who fixed some bugs and made the function much more robust
import os
import subprocess
import time
def assign_free_gpus(threshold_vram_usage=1500, max_gpus=2, wait=False, sleep_time=10):
"""
Assigns free gpus to the current process via the CUDA_AVAILABLE_DEVICES env variable
This function should be called after all imports,
@Haosvit
Haosvit / Hướng dẫn dùng git cơ bản
Last active May 2, 2024 07:18
Cái này viết khi làm chung đồ án với bạn hồi đại học, rất cơ bản. Ai chưa biết thì đọc qua, rồi dùng một thời gian sẽ quen.
I. Giới thiệu Git:
* Tóm tắt:
- Git dùng để quản lý phiên bản code, rất thuận lợi trong làm việc nhóm thậm chí làm 1 mình.
Git có nhiều trang hỗ trợ như: github.com, bitbucket.com, ... không phải git là chỉ riêng trang github, git giống như là 1 chuẩn
quản lý phiên bản, ngoài ra còn có SVN là 1 chuẩn khác để quản lý phiên bản (theo cách hiểu của t).
II. Các khái niệm trong git:
+ Repository (kho): là thư mục. Thư mục trên github.com gọi là remote (xa) repository (kho), còn ở máy tính là local repository.
+ Branch (nhánh): ví dụ t làm 1 phần trên 1 nhánh, m rẽ sang nhánh khác làm chức năng khác, sau này hộp lại (merge)
+ Remote (máy chủ): khỏi giải thích, lát ví dụ
+ add (thêm): sau khi làm gì đó thay đổi thì add (thêm) cái thay đổi đó vào