Skip to content

Instantly share code, notes, and snippets.

View jamesandariese's full-sized avatar

James Andariese jamesandariese

View GitHub Profile
@jamesandariese
jamesandariese / samba-ad-dc-kinit
Created August 21, 2022 17:19
self-enrolling your samba ad-dc in its kerberos
#!/bin/bash
HOST=$(hostname)
FQDN=$(hostname -f)
1>&2 echo "REMINDER: add additional SPNs by listing each as an additional argument."
if [ x = x"$FQDN" ] || [ "${FQDN%%.*}" != "$HOST" ] || [ "$HOST" = "$FQDN" ];then
(
exec 1>&2
@jamesandariese
jamesandariese / mkrootfstar.sh
Created December 14, 2021 21:17
make rootfs tarball for wsl or other purposes from a frozen docker image export
#!/bin/bash
### expects gzip, jq, and tar
### converts an image downloaded with the moby image download script into a rootfs.tar.gz file.
### get the moby script from https://github.com/moby/moby/blob/master/contrib/download-frozen-image-v2.sh
set -x
ROOT="$1"
@jamesandariese
jamesandariese / google.js
Last active November 20, 2023 15:58 — forked from vrumger/google.js
Create a google account and go to youtube with puppeteer.
const puppeteer = require('puppeteer');
const uuid = require('uuid');
const sleep = ms => new Promise(r => setTimeout(r, ms));
(async () => {
const browser = await puppeteer.launch({ headless: false });
const page = await browser.newPage();
const id = uuid.v4();
@jamesandariese
jamesandariese / diagram:.txt
Created November 19, 2019 04:12
A sample diagram from drawthe.net
diagram:
fill: "snow"
columns: 21
rows: 21
gridLines: false
gridPaddingInner: .25
groupPadding: .75
title:
color: black
heightPercentage: 6
@jamesandariese
jamesandariese / gist:0e9736a108fc3584e30fae87edfebeb5
Created May 22, 2019 00:40
Making docker socket available to multiple uids and gids
docker run -v /var/run/docker.sock:/var/run/docker.sock -v /var/run/docker.sock.virtual:/var/run/docker.sock.virtual -ti alpine/socat unix-listen:/var/run/docker.sock.virtual/1001,fork,user=1000,group=1001 unix-connect:/var/run/docker.sock
@jamesandariese
jamesandariese / host.sh
Created May 19, 2019 05:06
Docker stuff
perl -MSocket -e 'print inet_ntoa(inet_aton("strudelline.net")), "\n"'
### Keybase proof
I hereby claim:
* I am jamesandariese on github.
* I am caddr (https://keybase.io/caddr) on keybase.
* I have a public key ASCvE00c-qOi843z6KU8Zxrsgjq0jar1BWEntzCj4TGdnAo
To claim this, I am signing this object:
@jamesandariese
jamesandariese / primes.hs
Created November 25, 2018 23:55
Haskell Primes
-- lazy evaluation lets you make mutually recursive definitions
-- a prime is a number whose only factor is itself
isPrime :: Integer -> Bool
isPrime 0 = False
isPrime 1 = False
isPrime 2 = True
isPrime n = head (factors n) == n
-- the factors of a number are all the prime numbers that make it up
# put version in VERSION file. this will increment the minor version automatically.
VERSION=`((tr '.' ' ' < VERSION ; echo 1+f) | dc;echo f) | dc | paste -s -d . -`
echo $VERSION > VERSION
@jamesandariese
jamesandariese / fizzbuzz.hs
Last active September 12, 2016 03:31
haskell fizzbuzz
-- Return a list of strings of fizzbuzz from [1..]
fizzbuzz :: [[Char]]
fizzbuzz = fizzbuzz' 1
where
fizzbuzz' n =
fizzbuzzer : (fizzbuzz' (n + 1))
where fizzbuzzer
| fb3 = "Fizz"
| fb5 = "Buzz"
| fb3 && fb5 = "FizzBuzz"