Skip to content

Instantly share code, notes, and snippets.

View peixian's full-sized avatar
🦝

Peixian Wang peixian

🦝
View GitHub Profile
(defun format-gps-coordinates (latitude longitude)
"Format latitude and longitude into a human-readable string."
(let ((lat-hem (if (string-match "S" latitude) "S" "N"))
(long-hem (if (string-match "W" longitude) "W" "E")))
(format "%s, %s"
(replace-regexp-in-string " deg.*" "" latitude)
(replace-regexp-in-string " deg.*" "" longitude))))
(defun extract-exif-geolocation (file)
"Extract and format the EXIF geolocation data from an image file."
#!/bin/bash
#########################################################################################################################################
# This file takes in a kubectl context, namespace, pod selector, and erlang cookie and opens a non-hidden connection to the target pod. #
# It assumes that your deploy uses the pod IP as an IP address and atom, in the shape of :"SERVICE@<INTERNAL_KUBE_IP>" #
# It modifies either `iptables` or `pfctl` depending on your system. #
# Sources: #
# - https://quan.io/2019/09/02/using-erlangs-observer-in-kubernetes-for-an-elixir-release/ #
# - https://gist.github.com/avocade/2fe5f6c01832154eb51f05a2fef692ce #
# - https://www.openbsdhandbook.com/pf/cheat_
@peixian
peixian / gist:e9349dcc7a17d88ec31ab4bbe4cc4e5d
Last active August 29, 2019 19:54
Islamic Political Thought
All Dates are Tentative
Aug. 29: Course Introduction
September 2 Monday Labor Day Weekend - COLLEGE CLOSED - NO CLASSES
I. Interrogations
Session 1. (Sep. 5 & 9)
Hamid Dabashi “Can Non-Europeans Think?” in Hamid Dabashi (2015) Can Non-Europeans Think? London: Zed Books -- chapter 1

Keybase proof

I hereby claim:

  • I am peixian on github.
  • I am pylon (https://keybase.io/pylon) on keybase.
  • I have a public key whose fingerprint is 9040 3863 B81D 7507 2B5D 7C12 BA74 5EDD CD1F 203A

To claim this, I am signing this object:

@peixian
peixian / az_metrics.csv
Last active March 7, 2021 12:14
az metrics
We can make this file beautiful and searchable if this error is corrected: It looks like row 6 should actually have 7 columns, instead of 6. in line 5.
,Metric,Metric Display Name,Unit,Aggregation Type,Description,Dimensions
1, azure.analysisservices_servers.qpu_metric,QPU,Count,Average," Microsoft.AnalysisServices/servers: QPU. Range 0-100 for S1, 0-200 for S2 and 0-400 for S4",ServerResourceType
2, azure.analysisservices_servers.memory_metric,Memory,Bytes,Average," Microsoft.AnalysisServices/servers: Memory. Range 0-25 GB for S1, 0-50 GB for S2 and 0-100 GB for S4",ServerResourceType
3, azure.analysisservices_servers.total_connection_requests,Total Connection Requests,Count,Average, Microsoft.AnalysisServices/servers: Total connection requests. These are arrivals.,ServerResourceType
4, azure.analysisservices_servers.successfull_connections_per_sec,Successful Connections Per Sec,CountPerSecond,Average, Microsoft.AnalysisServices/servers: Rate of successful connection completions.,ServerResourceType
5, azure.analysisservices_servers.total_connection_failures,Total Connection Failures,Count,Average, Microsoft.AnalysisServices/servers: Total failed connection
@peixian
peixian / tea.agda
Created September 16, 2017 19:53
Make Programming Great Again
-- Implentation of TEA encrpytion in agda.
-- Very nearly a word for word clone of https://github.com/wmoss/haskell-Crypto/blob/80d25c75fff189acfd32a7383659dea0f6a61be8/Codec/Encryption/TEA.hs
module TEA where
open import Streams
open import Ops
open import Poly
open import Data.String hiding (_++_)
open import Data.Bool
# Hosts File: Ad Blocking Hosts
# This hosts file is brought to you by Dan Pollock and can be found at
# http://someonewhocares.org/hosts/
# You are free to copy and distribute this file for non-commercial uses,
# as long the original URL and attribution is included.
#
# See below for acknowledgements.
# Please forward any additions, corrections or comments by email to
@peixian
peixian / keybase.md
Created September 5, 2016 18:10
Identity Proof

Keybase proof

I hereby claim:

  • I am peixian on github.
  • I am pylon (https://keybase.io/pylon) on keybase.
  • I have a public key whose fingerprint is 6D07 5E13 D825 A106 AFDC 1FD1 D83F 4350 AF66 493A

To claim this, I am signing this object:

import json
import requests
story_str = 'https://hacker-news.firebaseio.com/v0/item/{}.json'
new_stories = requests.get('https://hacker-news.firebaseio.com/v0/newstories.json').json()
best_stories = requests.get('https://hacker-news.firebaseio.com/v0/beststories.json').json()
top_stories = requests.get('https://hacker-news.firebaseio.com/v0/beststories.json').json()
@peixian
peixian / iframe.css
Created March 24, 2016 20:06
iframe styles
iframe {
width: 100%;
height: 100%;
overflow-x: hidden;
overflow-y: hidden;
overflow: hidden;
border: 0px;
}