Skip to content

Instantly share code, notes, and snippets.

View michaelkebe's full-sized avatar

Michael Kebe michaelkebe

View GitHub Profile
package calculator;
public class CalculatorController {
private enum Operation {
NOP, ADDITION, SUBSTRACTION, MULTIPLICATION, DIVISION
}
private static final String INIT_DISPLAY_VALUE = "0.";
@michaelkebe
michaelkebe / gist:973474
Created May 15, 2011 19:50
Scala Client for SQLSpaces
import info.collide.sqlspaces.client.TupleSpace
import info.collide.sqlspaces.commons._
object ScalaDom {
import scala.xml._
import org.w3c.dom.{Document => JDocument, Node => JNode}
import javax.xml.parsers.DocumentBuilderFactory
def dom(n: Node): JDocument = {
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_ISA_DEFS_H
#define _SYS_ISA_DEFS_H
/*
* This header file serves to group a set of well known defines and to
#undef _FOO1
#undef _FOO2
#undef _FOO2
#undef _BAR1
#undef _BAR2
#undef _BAR3
#define _FOO3 42
@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
@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 / 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
// This is generated from bitburner
/** @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 ...")