Skip to content

Instantly share code, notes, and snippets.

View Fang-Li's full-sized avatar
🎯
Focusing

Fang-Li

🎯
Focusing
View GitHub Profile
@kirk91
kirk91 / http_unix.go
Last active July 16, 2021 14:12
Http over unix domain socket
package main
import (
"fmt"
"net"
"net/http"
"os"
)
func main() {
@bessarabov
bessarabov / gist:674ea13c77fc8128f24b5e3f53b7f094
Last active August 23, 2024 19:11
One-liner to generate data shown in post 'At what time of day does famous programmers work?' — https://ivan.bessarabov.com/blog/famous-programmers-work-time
git log --author="Linus Torvalds" --date=iso | perl -nalE 'if (/^Date:\s+[\d-]{10}\s(\d{2})/) { say $1+0 }' | sort | uniq -c|perl -MList::Util=max -nalE '$h{$F[1]} = $F[0]; }{ $m = max values %h; foreach (0..23) { $h{$_} = 0 if not exists $h{$_} } foreach (sort {$a <=> $b } keys %h) { say sprintf "%02d - %4d %s", $_, $h{$_}, "*"x ($h{$_} / $m * 50); }'
@baymaxium
baymaxium / content.md
Created October 18, 2017 08:31
上帝说:要有一门面向未来的语言,于是有了 erlang

原文:程序人生

今个谈谈 erlang。我之前谈过不少语言:

elixir:灵丹妙药?or 徒有其名?

Javascript: 世纪机器语言?

golang五周岁。

@arkadiusjonczek
arkadiusjonczek / gist:8836e724a53ddd55362644745cf8ca4c
Created December 31, 2016 01:30
Start Chrome in App Mode on Mac OS X
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --app="http://www.google.de"
@so0k
so0k / kubectl.md
Last active February 4, 2025 17:16
Playing with kubectl output

Kubectl output options

Let's look at some basic kubectl output options.

Our intention is to list nodes (with their AWS InstanceId) and Pods (sorted by node).

We can start with:

kubectl get no
@stefansundin
stefansundin / install-pre-commit.sh
Last active January 21, 2025 15:09
Git pre-commit check to stop accidental commits to master/main/develop branches.
#!/bin/bash
# This gist contains pre-commit hooks to prevent you from commiting bad code or to the wrong branch.
# There are six variants that I have built:
# - pre-commit: stops commits to master/main/develop branches.
# - pre-commit-2: also includes a core.whitespace check.
# - pre-commit-3: the core.whitespace check and an EOF-newline-check.
# - pre-commit-4: only the core.whitespace check.
# - pre-commit-5: elixir formatting check.
# - pre-commit-6: prettier formatting check.
# Set the desired version like this before proceeding:
@izmailoff
izmailoff / os_stats.sh
Last active June 12, 2020 17:07
collects OS stats on Linux
#!/bin/bash
# Collects system performance statistics such as CPU, memory, and disk
# usage as well as top processes ran by users.
#
# All size values are in KiB (memory, disk, etc).
# Takes these command line arguments:
# $1 - cpuThreshold in % of total across all CPUs. Default is provided in no-args option.
@robertoaloi
robertoaloi / kill-erlang-node.sh
Created February 8, 2014 13:55
Kill an Erlang process by node name
#!/usr/bin/env bash
# Kill an Erlang process by node name
#
# e.g.: kill-erlang-node kred
# Check usage
if [ -z "$1" ]; then
echo "Usage: `basename $0` NODE_NAME"
exit 1
@jolros
jolros / gclone
Last active May 30, 2021 14:13
Script that clones a github repository into a nested githubuser/repositoryname directory within the current working directory or directory specified by the GITHUB_CLONE_HOME environment variable. Also works for gists. This allows your github clones to be organized cleanly and consistently. http://blog.jolros.com/consistent-github-cloning
#!/usr/bin/env perl
use File::Path qw(make_path);
use File::Spec;
use strict;
use warnings;
@ARGV || die 'Must provide repository information as an argument';
my $raw = $ARGV[0];
@prwhite
prwhite / Makefile
Last active June 5, 2025 06:52
Add a help target to a Makefile that will allow all targets to be self documenting
# Add the following 'help' target to your Makefile
# And add help text after each target name starting with '\#\#'
help: ## Show this help.
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'
# Everything below is an example
target00: ## This message will show up when typing 'make help'
@echo does nothing