Skip to content

Instantly share code, notes, and snippets.

View fannyhasbi's full-sized avatar

Fanny Hasbi fannyhasbi

View GitHub Profile
@redmcg
redmcg / kubedf
Last active July 3, 2024 20:55
Bash script to show k8s PVC usage
#!/usr/bin/env bash
NODESAPI=/api/v1/nodes
function getNodes() {
kubectl get --raw $NODESAPI | jq -r '.items[].metadata.name'
}
function getPVCs() {
jq -s '[flatten | .[].pods[].volume[]? | select(has("pvcRef")) | '\
@miguelmota
miguelmota / iota.js
Created March 22, 2019 19:22
Node.js iota (Golang iota equivalent)
const iota = (() => { let n = 0; return () => n++ })()
const myEnum = {
foo: iota(), // 0
bar: iota(), // 1
baz: iota(), // 2
qux: iota(), // 3
}
@fgilio
fgilio / axios-catch-error.js
Last active April 11, 2024 19:02
Catch request errors with Axios
/*
* Handling Errors using async/await
* Has to be used inside an async function
*/
try {
const response = await axios.get('https://your.site/api/v1/bla/ble/bli');
// Success 🎉
console.log(response);
} catch (error) {
// Error 😨
@ueokande
ueokande / benchmark-commands.md
Last active January 22, 2024 12:38 — forked from jkreps/benchmark-commands.txt
Kafka Benchmark Commands

Benchmark commands

Producer

Setup

bin/kafka-topics.sh \
  --zookeeper zookeeper.example.com:2181 \
  --create \
@coryhouse
coryhouse / package.json
Last active April 26, 2024 13:01
Example of calling one script from another
{
"name": "npm-scripts-example",
"version": "1.0.0",
"description": "npm scripts example",
"scripts": {
"clean": "rimraf ./dist && mkdir dist",
"prebuild": "npm run clean",
"build": "cross-env NODE_ENV=production webpack"
}
}
@lancejpollard
lancejpollard / c-to-assembly.md
Last active April 16, 2024 17:57
Simple C examples and their Assembly output from GCC 4.9.0

addition

int foo(int a, int b) {
  return a + b;
}
@alexeypegov
alexeypegov / proto.msg
Last active April 27, 2022 23:36
ProtoBuffers debug with CURL. ProtoBuffers should be installed first: "yum install protobuf" or "brew install protobuf".
key:"string value"
int_key:22