Skip to content

Instantly share code, notes, and snippets.

View bluet's full-sized avatar
🏠
Working from home

BlueT - Matthew Lien - 練喆明 bluet

🏠
Working from home
View GitHub Profile
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active November 14, 2024 09:13
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@audreyt
audreyt / posa.mkdn
Last active November 28, 2022 21:24
EtherCalc.tw

從 SocialCalc 到 EtherCalc

先前在《開源應用程式架構》 一書中,我介紹了 SocialCalc 這個在瀏覽器中運行的試算表編輯器,以取代伺服器為中心的 WikiCalc 架構。SocialCalc 在瀏覽器中執行所有的運算,只有在載入和儲存試算表時才會使用伺服器。

追求效能是 Socialtext 團隊在 2006 年時設計 SocialCalc 的主要目的。重點在於:在 JavaScript 環境下執行客戶端運算,儘管在當年的速度僅有伺服器端 Perl 運算的十分之一,但仍然勝過 AJAX 來回傳輸資料造成的網路延遲:


WikiCalc 與 SocialCalc 架構比較

******
@brianredbeard
brianredbeard / tmux.conf
Created February 12, 2014 20:10
A better starting tmux config. Live like screen, but better
# make CTRL+a the 'prefix' ala screen.
bind C-a send-prefix
set -g prefix C-a
# get rid of the tmux standard of CTRL+b
unbind C-b
set -s escape-time 1
set -g base-index 1
setw -g pane-base-index 1
# make it easy to reload the config (CTRL+r)
@danackerson
danackerson / 100_base.conf
Last active September 19, 2024 15:42
using nginx + lua + redis for redirects and rewrites
# using such a setup requires `apt-get install lua-nginx-redis` under Ubuntu Trusty
# more info @ http://wiki.nginx.org/HttpLuaModule#access_by_lua
http {
lua_package_path "/etc/nginx/include.d/?.lua;;";
lua_socket_pool_size 100;
lua_socket_connect_timeout 10ms;
lua_socket_read_timeout 10ms;
server {
@xero
xero / irc.md
Last active October 29, 2024 15:25
irc cheat sheet
@mtigas
mtigas / 0-hidden-service-subdomains.md
Last active August 4, 2024 16:24
Example code for running a (HTTP/HTTPS) Tor hidden service supporting subdomains.

The following files show an example of how to create subdomains for onion site hidden services. (This hasn't been tested for hidden services for anything other than HTTP/HTTPS.)

(You might also want to read our blog post about ProPublica’s Tor hidden service, including a tutorial and notes on running a hidden service: https://www.propublica.org/nerds/item/a-more-secure-and-anonymous-propublica-using-tor-hidden-services )

In general, this works (maybe just in recent Tor clients) because Tor will handle the connection to www.xxxxxxxxxxxxxxxx.onion as a connection to xxxxxxxxxxxxxxxx.onion. The encapsulated HTTP/HTTPS connection contains the subdomain in the Host: header (and in the case of HTTPS, the SNI

@spbriggs
spbriggs / aws-cheapest.php
Created August 31, 2016 07:38
PHP script to scrape spot instance pricing data from Amazon AWS and display cheapest region for each instance tyoe
<?php
// Copyright Simon Briggs 2016
// Licensed under the Gnu Lesser General Public License
// https://www.gnu.org/licenses/lgpl.txt
// Get pricing data from Amazon
// (For better performance get the data and cache it with a cron job)
$data = file_get_contents("https://spot-price.s3.amazonaws.com/spot.js");
// Trim off the JSONP function to give us propert JSON
$data = substr($data, 9, strlen($data)-10);
@rmcintosh
rmcintosh / Most Common Download Hashes
Last active July 22, 2020 19:54
SSH Honeypot Stats
1,2d68e605d5c23507a502f69a93d7c352cbe40ebee54a1b54944ef535add0a02b
2,2409fb21fe377f7e12dda392f26d7c93b7715239169d362dd907fe499ab38ee9
3,0636d8749ecb285c293dc533c9b7690ba17ac7902488bf39164129a12d54c1c3
4,32db4c85faf0d58065912af97522befafcfdf73e92a3d549ea11921d25cc6547
4,94b59b4761147519fecf662cecba7219ac2f70682ae02685081a181758cb705f
7,dd58910a2ea62dd1a48b297f589e7df315c9618d87624122bbe2a7eb94d33d99
8,16e4ea7fb26ca210415224006bc417db3524f0332d48ff9deaeee979f2f93add
8,c15f59b58e9d9f3b992287037c8e7d3dd42f22979cb41de4389c25efcab6509b
26,3e05c20fbc42b6d8930f03d7bc4c12d1f498147962e7c500c3545bfdaa5bfa42
@offirgolan
offirgolan / unwatch-gh-org.js
Created August 2, 2017 05:57
Unwatch All Org Repos
// Navigate to https://github.com/watching and then run:
// Taken from: https://stackoverflow.com/questions/11043374/how-to-unwatch-multiple-repos-easily-on-github
Array.prototype
.slice.apply(document.querySelectorAll('.js-subscription-row'))
.forEach(el => { const org = el.querySelector('a[href^="/YOUR_ORG"]'); if (org) el.querySelector('button').click()});

Running Minikube via LXD

I make some assumptions, and make no claims in how well supported this is or ever will be. I wanted to avoid using VMs because i've been working in containers for the last half decade. It made sense to just skip the middle man and use a machine type container system to run my minikube workloads.

Why not juju?

Simply put, Juju does a fantastic job; but to stay objective I wanted to achieve minikube in LXD as a functional alternative to juju deploy kubernetes-core, or using KVM/VirtualBox in this solution.