Skip to content

Instantly share code, notes, and snippets.

@BrockA
BrockA / waitForKeyElements.js
Created May 7, 2012 04:21
A utility function, for Greasemonkey scripts, that detects and handles AJAXed content.
/*--- waitForKeyElements(): A utility function, for Greasemonkey scripts,
that detects and handles AJAXed content.
Usage example:
waitForKeyElements (
"div.comments"
, commentCallbackFunction
);
@slawekzachcial
slawekzachcial / aws-sigv4-ssm-get-parameter.sh
Last active May 3, 2024 02:51
Using CURL to call AWS ReST API, signing request with v4 signature
#!/bin/bash
# Source: https://docs.aws.amazon.com/general/latest/gr/sigv4-signed-request-examples.html
[[ -n "${AWS_ACCESS_KEY_ID}" ]] || { echo "AWS_ACCESS_KEY_ID required" >&2; exit 1; }
[[ -n "${AWS_SECRET_ACCESS_KEY}" ]] || { echo "AWS_SECRET_ACCESS_KEY required" >&2; exit 1; }
readonly parameterName="SlawekTestParam"
readonly method="POST"
@1eedaegon
1eedaegon / readImageFromExcel.js
Last active May 3, 2024 02:51
Read image from excel file using ExcelJS
const ExcelJS = require('exceljs');
const workbook = new ExcelJS.Workbook();
const data = await workbook.xlsx.readFile('./test.xlsx');
const worksheet = workbook.worksheets[0];
for (const image of worksheet.getImages()) {
console.log('processing image row', image.range.tl.nativeRow, 'col', image.range.tl.nativeCol, 'imageId', image.imageId);
// fetch the media item with the data (it seems the imageId matches up with m.index?)
const img = workbook.model.media.find(m => m.index === image.imageId);
fs.writeFileSync(`${image.range.tl.nativeRow}.${image.range.tl.nativeCol}.${img.name}.${img.extension}`, img.buffer);

minh.nguyen: Thông thường thì em sẽ follow theo (hầu hết) các bước sau:

  • RTFM.
  • Dựng và chạy hệ thống với các settings được recommend trong doc. Ví dụ Redis sẽ có sentinel hoặc Redis cluster hoặc standalone.
  • Explore tất cả các feature của system hoặc tất cả interface của library, nhất là những feature nào có vẻ fancy.
  • Build from source. Chạy lại bằng build object được sinh ra. Ngó thử xem hệ thống có bao nhiêu components, dependencies.
  • Đọc thử design doc nếu có
  • Debug thử xem giữa các component liên hệ với nhau như thế nào. Thông thường các hệ thống đều có doc.
  • Pick một flow đơn giản nhất, Tìm thử entrypoint trong code. Đặt debugger xem thử chạy ra sao.
  • Change thử một feature nho nhỏ xem thê nào
@andrewgdunn
andrewgdunn / w541.md
Created June 26, 2016 15:37
w541 notes

Lenovo ThinkPad W541

The W541 is a workstation laptop based on the Intel Haswell architecture which has an Nvidia GK106GLM (Quadro K2100M) discrete card configured via Optimus.

This architecture poses some challenges within Linux. In the Windows world Nvidia handles all complexities of both adapters, in Linux the herculean effort of the Bumblebee project allows you to tackle the complex topology and have a usable system.

@balmeida-nokia
balmeida-nokia / wsl2_ciscoanyconnect_workaround.md
Last active May 3, 2024 02:43 — forked from pyther/wsl2_ciscoanyconnect_workaround.md
WSL 2 Cisco AnyConnect Networking Workaround

WSL 2 Cisco AnyConnect Networking Workaround

Overview

WSL 2 uses a Hyper-V Virtual Network adapter. Network connectivity works without any issue when a VPN is not in use. However when a Cisco AnyConnect VPN session is established Firewall Rules and Routes are added which breaks connectivity within the WSL 2 VM. This issue is tracked WSL/issues/4277

Below outline steps to automatically configure the Interface metric on VPN connect and update DNS settings (/etc/resolv.conf) on connect/disconnect.

Acknowledges

@pablotolentino
pablotolentino / Visual Studio 2022 Product Key
Created November 20, 2021 20:41
Visual Studio 2022 Enterprise Product key
Visual Studio 2022
Enterprise :
VHF9H-NXBBB-638P6-6JHCY-88JWH
Professional:
TD244-P4NB7-YQ6XK-Y8MMM-YWV2J
@bmaupin
bmaupin / free-database-hosting.md
Last active May 3, 2024 02:33
Free database hosting
@adamelliotfields
adamelliotfields / windows-ssh-no-password-with-keys-wsl2.md
Last active May 3, 2024 02:33
Windows SSH Server with Password-less Key Authentication and Default WSL2 Shell

Windows SSH Server with Password-less Key Authentication and Default WSL2 Shell

Disclaimer: I am not a Windows Admin and I'm not even that good with PowerShell.

I wanted to be able to SSH into my Windows laptop directly into Linux. I also wanted to disable password authentication and only allow public key (RSA in my case) authentication.

Scott Hanselman wrote a blog post on how to make your default WSL2 distro your default shell for SSH. Windows OS Hub published an article on using public key

@5a494d
5a494d / clean.sh
Created August 4, 2020 19:21 — forked from Iman/clean.sh
Free up disk space on Ubuntu - clean log, cache, archive packages/apt archives, orphaned packages, old kernel and remove the trash
#!/bin/sh
#Check the Drive Space Used by Cached Files
du -sh /var/cache/apt/archives
#Clean all the log file
#for logs in `find /var/log -type f`; do > $logs; done
logs=`find /var/log -type f`
for i in $logs