Skip to content

Instantly share code, notes, and snippets.

View michaelkebe's full-sized avatar

Michael Kebe michaelkebe

View GitHub Profile
FROM ubuntu
RUN apt-get update && apt-get install -y netcat-openbsd
COPY ./docker-sock-info /
COPY ./watcher.sh /
RUN chmod +x /watcher.sh
CMD /watcher.sh
@michaelkebe
michaelkebe / docker-compose.yml
Created September 30, 2022 06:54
Ordering of loki entries with same timestamp is wrong
version: "3"
services:
loki:
image: grafana/loki:2.6.1
command: -config.file=/etc/loki/loki-config.yml
ports:
- "3100:3100"
volumes:
- ./loki-config.yml:/etc/loki/loki-config.yml
/** @param {NS} ns **/
export async function main(ns) {
const delay = ns.args[1]
if (delay) {
await ns.sleep(delay)
}
await ns.hack(ns.args[0])
}
import { Octokit } from "https://cdn.skypack.dev/@octokit/rest";
import { PERSONAL_ACCESS_TOKEN } from "token.js"
// Create a token.js with this content
// export const PERSONAL_ACCESS_TOKEN = "ghp_abcdef1234567890"
/** @param {NS} ns **/
export async function main(ns) {
if (ns.args.length == 0) {
ns.tprint("Usage: run gists.js file1 file2 file3 ...")
/** @param {NS} ns **/
export async function main(ns) {
const delay = ns.args[1]
if (delay) {
await ns.sleep(delay)
}
await ns.hack(ns.args[0])
}
// This is generated from bitburner
@michaelkebe
michaelkebe / gist:4f279dacfb9b506ed4e3ea8ba7ab7c57
Created December 8, 2020 20:53
check docker hub pull rate oneliner
# requires curl, jq, grep
curl -s --head -H "Authorization: Bearer $(curl -s "https://auth.docker.io/token?service=registry.docker.io&scope=repository:ratelimitpreview/test:pull" | jq -r .token)" https://registry-1.docker.io/v2/ratelimitpreview/test/manifests/latest | grep RateLimit
@michaelkebe
michaelkebe / hosts.ini
Last active June 5, 2020 14:06
ansible group position bug when inventory is yml
[my_group]
host-1
host-2
host-3
@michaelkebe
michaelkebe / gitlab_add_group_members_from_another_group.sh
Created February 13, 2019 07:13
Script to add gitlab users from one group to another
#!/bin/sh
GITLAB_URL="https://git.acme.com"
PRIVATE_TOKEN="abcde-fghijklmnop"
FROM_GROUP_ID=$1
TO_GROUP_ID=$2
ACCESS_LEVEL=40
USERIDS_OF_GROUP=$(curl -s --header "PRIVATE-TOKEN: $PRIVATE_TOKEN" $GITLAB_URL/api/v4/groups/$FROM_GROUP_ID/members| jq ".[].id")
for USERID in $USERIDS_OF_GROUP
#undef _FOO1
#undef _FOO2
#undef _FOO2
#undef _BAR1
#undef _BAR2
#undef _BAR3
#define _FOO3 42