Skip to content

Instantly share code, notes, and snippets.

View phs's full-sized avatar
💭
https://gitlab.com/philhsmith

Phil Smith phs

💭
https://gitlab.com/philhsmith
View GitHub Profile
@phs
phs / gist:91a9a0a675254c8cb1b03d5f6716f15d
Created April 19, 2023 17:27
SD 2.1 on keras-cv toy.py
#! /usr/bin/env python
from datetime import datetime
from keras_cv.models import StableDiffusionV2
from PIL import Image
BATCH_SIZE = 1
IMAGE_SIZE = 384
PROMPT = 'beautiful bird, photo-realistic'
### Keybase proof
I hereby claim:
* I am phs on github.
* I am phs (https://keybase.io/phs) on keybase.
* I have a public key whose fingerprint is FAFE E9B3 5843 C7C8 3523 3013 8881 9421 2B4F F174
To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am phs on github.
  • I am phs (https://keybase.io/phs) on keybase.
  • I have a public key whose fingerprint is BC4C 9941 6520 8CC5 F1CE FE5B A059 46AC CE1F DC8E

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am phs on github.
  • I am phs (https://keybase.io/phs) on keybase.
  • I have a public key whose fingerprint is F7EC 6337 025D 297D 4F2E B210 C660 6941 A3BF 8F3A

To claim this, I am signing this object:

## --------------------------------------------------------------------
#' Load configuration parameters from .env into environment variables
#'
#' It has become a practice to store configuration parameters related
#' to a project, in a hidden file called \code{.env}, in the working
#' directory of a project, and then set them as environment variables.
#'
#' This package loads the variables defined in the \code{.env} file
#' in the current working directory (as reported by \code{getwd}),
Process: Brogue [83248]
Path: /opt/homebrew-cask/*/Brogue.app/Contents/MacOS/Brogue
Identifier: com.Brogue
Version: 1.7.4
Code Type: X86 (Native)
Parent Process: ??? [1]
Responsible: Brogue [83248]
User ID: 501
Date/Time: 2015-12-07 00:21:39.002 -0800
@phs
phs / congress-carlo.rb
Created October 17, 2015 17:56
Simple Monte Carlo to predict who will control US Congress after the 2016 elections
#! /usr/bin/env ruby
class CongressCarlo
TRIALS = 100_000
STAR_SCALE = 500
attr_reader :name, :dems_not_running, :reps_not_running
def estimate(*ratings)
@phs
phs / gist:ffcb9f4d05311627d5e8
Created February 10, 2015 01:15
What I had to do to make hgfs (monolithic.version = "9.9.0", vmhgfs.version = "1.4.1.1") compile on guest ubuntu 3.2.0-76-virtual
diff -ru a/vmhgfs-only/inode.c b/vmhgfs-only/inode.c
--- a/vmhgfs-only/inode.c 2014-11-18 03:07:13.000000000 +0100
+++ b/vmhgfs-only/inode.c 2014-12-23 22:47:15.783855237 +0100
@@ -1922,7 +1922,7 @@
p,
#endif
&inode->i_dentry,
- d_alias) {
+ d_u.d_alias) {
int dcount = hgfs_d_count(dentry);
@phs
phs / mozscape-from-google-spreadsheet.js
Last active December 19, 2015 12:09
Mozscape API Demo from a Google Spreadsheet source
/**
* Returns an gmt epoch timestamp integer 4 hours into the future, to use as an API call expiration.
*/
function expiresTimestamp() {
var nowAsEpochGMTSeconds = Math.floor(new Date().getTime() / 1000.0);
var fourHoursFromNow = nowAsEpochGMTSeconds + 3600 * 4;
return fourHoursFromNow;
};
/**
@phs
phs / gist:5693053
Created June 2, 2013 08:43
Applescript to open up the app store and search for Xcode
tell application "App Store"
activate
delay 5 -- wait for it to start
end tell
tell application "System Events"
tell window "App Store" of process "App Store"
-- Search for Xcode
tell text field 1 of group 7 of tool bar 1