Skip to content

Instantly share code, notes, and snippets.

View luoyjx's full-sized avatar
📖

yanjixiong luoyjx

📖
View GitHub Profile
@ismasan
ismasan / sse.go
Last active August 23, 2024 08:47
Example SSE server in Golang
// Copyright (c) 2017 Ismael Celis
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@wanming
wanming / gist:61365afc17b6cfed5487
Created July 6, 2015 07:27
石墨架构概览

###石墨整体架构一览 ####前端篇

#####框架 石墨的前端使用的框架很传统:jQuery + RequireJS,我们使用RequireJS的text模块引入模板,手动用代码渲染数据,没有使用AngularJS之类的MV*框架的原因是自己编写的js更灵活,拓展性更好。框架们的功能都很强大,但是当遇到一些复杂依赖或者性能问题时,坑往往会很深。

#####环境结构

在生产环境下

<audio id="alarm" src="alarm.ogg" controls></audio>
<script>
const alarmElement = document.getElementById('alarm');
const alarmTimes = [
new Date('2015-11-13 07:00 -0500'),
new Date('2015-11-13 08:00 -0500'),
new Date('2015-11-13 08:30 -0500'),
];
function playAlarm() {
@Munawwar
Munawwar / array-diff.html
Last active April 29, 2023 08:56
O(n) array diff & patch algorithm in JavaScript (unlike LCS, this is a trade-off for speed than minimum changes).
<html>
<body>
<script>
/**
* This array diff algorithm is useful when one wants to detect small changes
* (like consecutive insertions or consecutive deletions) several times
* in short time intervals. Alternative algorithms like LCS woud be too expensive
* when running it too many times.
*/
@maxvt
maxvt / infra-secret-management-overview.md
Last active July 5, 2024 13:01
Infrastructure Secret Management Software Overview

Currently, there is an explosion of tools that aim to manage secrets for automated, cloud native infrastructure management. Daniel Somerfield did some work classifying the various approaches, but (as far as I know) no one has made a recent effort to summarize the various tools.

This is an attempt to give a quick overview of what can be found out there. The list is alphabetical. There will be tools that are missing, and some of the facts might be wrong--I welcome your corrections. For the purpose, I can be reached via @maxvt on Twitter, or just leave me a comment here.

There is a companion feature matrix of various tools. Comments are welcome in the same manner.

@ammario
ammario / ipint.go
Last active May 25, 2024 21:43
Golang IP <-> int conversion
func ip2int(ip net.IP) uint32 {
if len(ip) == 16 {
return binary.BigEndian.Uint32(ip[12:16])
}
return binary.BigEndian.Uint32(ip)
}
func int2ip(nn uint32) net.IP {
ip := make(net.IP, 4)
binary.BigEndian.PutUint32(ip, nn)
@jcataluna
jcataluna / gist:1dc2f31694a1c301ab34dac9ccb385ea
Created July 8, 2016 17:23
Script to save all images from a docker-compose.yml file
#!/bin/bash
mkdir -p out
for img in `grep image $1| sed -e 's/^.*image\: //g'`;
do
cleanname=${img/\//-}
tag=`docker images | grep $img | awk '{print $2}'`
echo "Exporting image: $img, tag:$tag ($cleanname)..."
docker save $img -o out/$cleanname.tar
@nikhita
nikhita / update-golang.md
Last active August 25, 2024 13:42
How to update the Go version

How to update the Go version

System: Debian/Ubuntu/Fedora. Might work for others as well.

1. Uninstall the exisiting version

As mentioned here, to update a go version you will first need to uninstall the original version.

To uninstall, delete the /usr/local/go directory by:

@matthewjberger
matthewjberger / notes.md
Last active March 11, 2024 10:21
How to make an electron app using Create-React-App and Electron with Electron-Builder.