Skip to content

Instantly share code, notes, and snippets.

View geekeren's full-sized avatar
🎯
Focusing

Baiyuan Wang geekeren

🎯
Focusing
View GitHub Profile
@geekeren
geekeren / download-uncompress-gz-from-remote
Last active June 3, 2019 08:05
Download and uncompress tar.gz
wget -c https://github.com/sergiitk/pagerbeauty/archive/v$PAGERBEAUTY_VERSION.tar.gz -O - | \
tar zxf - -C $APP_DIR --strip-components 1
@geekeren
geekeren / dd-config-to-mask-email.yaml
Last active June 24, 2019 02:51
Datadog config to mask Email in logs
logs_enabled: true
logs_config:
processing_rules:
- type: mask_sequences
name: mask_user_email
pattern: "([a-zA-Z0-9_\\-\\.]+)@([a-zA-Z0-9_\\-\\.]+)\\.([a-zA-Z]{2,5})"
replace_placeholder: "<MASKED_EMAIL>"
@geekeren
geekeren / electron-floating-window.js
Last active March 10, 2022 11:34
electron Floating Window
let floatingWindow;
const createFloatingWindow = function() {
const electron = require('electron');
const BrowserWindow = electron.BrowserWindow;
if (!floatingWindow) {
floatingWindow = new BrowserWindow({
width: 1000,
height: 80,
titleBarStyle: 'hide',
transparent: true,
@geekeren
geekeren / README.md
Last active July 10, 2019 02:48
LetsEncrypt Auto Renew Scripts

LetsEncrypt Auto Renew Scripts

securityDefinitions:
auth0:
type: oauth2
scopes: {}
flow: accessCode
authorizationUrl: https://wangbaiyuan.auth0.com/authorize
tokenUrl: https://wangbaiyuan.auth0.com/oauth/token
x-token-validation-url: https://wangbaiyuan.auth0.com/oauth/access_token
function (user, context, callback) {
const mapping = {
readonly: "arn:aws:iam::xxxx:role/ReadOnly,arn:aws:iam::xxxx:saml-provider/Auth0",
admin: "arn:aws:iam::xxxx:role/Admin,arn:aws:iam::xxxx:saml-provider/Auth0",
};
user.awsRole = mapping.readonly;
if (context.authorization.roles.findIndex(role => role === "Admin") >= 0) {
user.awsRole = mapping.admin;