Skip to content

Instantly share code, notes, and snippets.

View aggresss's full-sized avatar
♾️
kata

Jagger Yu aggresss

♾️
kata
View GitHub Profile
package main
import (
"fmt"
"time"
)
func main() {
c := make(chan int)
go send(c)
@aggresss
aggresss / CMakeLists.txt
Last active February 11, 2019 10:35
返回工具链的前缀
# reference: https://cmake.org/cmake/help/latest/command/string.html
cmake_minimum_required (VERSION 2.8)
# Returns the compiler prefix
function(compiler_prefix input_string output_string)
string(REGEX MATCH "[^/]+$" compiler_basename ${input_string})
string(REGEX MATCH "[^-]+$" compiler_id ${compiler_basename})
if(NOT ${compiler_basename} STREQUAL ${compiler_id})
string(REPLACE "-${compiler_id}" "" compiler_host ${compiler_basename})
endif()
@aggresss
aggresss / ajax-success.js
Last active November 8, 2018 10:10
ajax-success
$.ajax({
type: "POST",
url: url,
contentType: "application/json; charset=utf-8",
data: JSON.stringify(data),
dataType: "json",
statusCode: {
200: function() {alert("成功")}
},
error: function(xhr, status, error) {

Accessible color palette

A set of colors that is unambiguous both to colorblinds and non-colorblinds.

Color name R G B
Black 0 0 0
Orange 230 159 0
Sky Blue 86 180 233
Bluish Green 0 158 115
@aggresss
aggresss / webrtc.js
Created July 9, 2020 14:52 — forked from daurnimator/webrtc.js
Playing with WebAudio and WebRTC
// Browser compat
window.AudioContext = window.AudioContext || window.webkitAudioContext;
window.RTCPeerConnection = window.RTCPeerConnection || window.webkitRTCPeerConnection || window.mozRTCPeerConnection;
navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia;
var key = window.location.hash.substring(1);
var audio_context = new AudioContext();
var local_output = audio_context.createMediaStreamDestination();
@aggresss
aggresss / webrtc.js
Created July 9, 2020 14:52 — forked from daurnimator/webrtc.js
Playing with WebAudio and WebRTC
// Browser compat
window.AudioContext = window.AudioContext || window.webkitAudioContext;
window.RTCPeerConnection = window.RTCPeerConnection || window.webkitRTCPeerConnection || window.mozRTCPeerConnection;
navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia;
var key = window.location.hash.substring(1);
var audio_context = new AudioContext();
var local_output = audio_context.createMediaStreamDestination();
@aggresss
aggresss / handling_multiple_github_accounts.md
Created December 14, 2020 11:41 — forked from Jonalogy/handling_multiple_github_accounts.md
Handling Multiple Github Accounts on MacOS

Handling Multiple Github Accounts on MacOS

The only way I've succeeded so far is to employ SSH.

Assuming you are new to this like me, first I'd like to share with you that your Mac has a SSH config file in a .ssh directory. The config file is where you draw relations of your SSH keys to each GitHub (or Bitbucket) account, and all your SSH keys generated are saved into .ssh directory by default. You can navigate to it by running cd ~/.ssh within your terminal, open the config file with any editor, and it should look something like this:

Host *
 AddKeysToAgent yes

> UseKeyChain yes

@aggresss
aggresss / lazy_load_posh-git.ps1
Created January 3, 2021 01:09
Lazy load posh-git
function git_prompt {
if (-not $(Get-InstalledModule -Name "posh-git")) {
Install-Module posh-git -Scope CurrentUser -Force
}
if (-not (Get-Module -Name "posh-git")) {
Import-Module -Name posh-git -Scope Global
}
else {
$GitPromptSettings.EnablePromptStatus = -not $GitPromptSettings.EnablePromptStatus
}
# SSH Agent Functions
# Mark Embling (http://www.markembling.info/)
#
# How to use:
# - Place this file into %USERPROFILE%\Documents\WindowsPowershell (or location of choice)
# - Import into your profile.ps1:
# e.g. ". (Resolve-Path ~/Documents/WindowsPowershell/ssh-agent-utils.ps1)" [without quotes]
# - Enjoy
#
# Note: ensure you have ssh and ssh-agent available on your path, from Git's Unix tools or Cygwin.
@aggresss
aggresss / README.md
Last active February 24, 2022 04:44

A tinker and plumber

aggresss's GitHub stats