Skip to content

Instantly share code, notes, and snippets.

View epequeno's full-sized avatar

Steven Pequeno epequeno

View GitHub Profile
@epequeno
epequeno / Layout.elm
Created December 1, 2018 22:52
basic layout example using elm-ui
-- Elm 0.19.0
-- mdgriffith/elm-ui 1.1.0
import Element exposing (..)
import Element.Background as Background
import Element.Border as Border
import Element.Font as Font
main =
layout [] myLayout
@epequeno
epequeno / Fibo.elm
Last active November 25, 2018 17:05
recursive fibo demo app
-- Elm 0.19.0
import Html exposing (..)
import Html.Events exposing (..)
import Html.Attributes exposing (..)
import Browser
main =
Browser.sandbox { init = init, view = view, update = update }
type alias Model
@epequeno
epequeno / Blue.elm
Last active April 6, 2023 21:02
example of multiple elm apps on a single page
-- Elm 0.19.0
module Blue exposing (main)
import Html exposing (..)
main =
div [] [ text "Hello from Blue!" ]
@epequeno
epequeno / helloWorld.elm
Last active November 24, 2018 21:31
boilerplate simple hello world elm app for Elm 0.19.0
-- Elm 0.19.0
import Browser
import Html exposing (..)
main =
Browser.sandbox { init = init, view = view, update = update }
type alias Model =
String
@epequeno
epequeno / retry.rs
Created October 13, 2018 21:44
example of re-creating a client when an initial request gets a 401 response
extern crate reqwest;
use reqwest::*;
#[derive(Debug)]
struct MyClient {
client: Client,
token: String
}
impl MyClient {
@epequeno
epequeno / fizzbuzz.rs
Created October 3, 2018 12:05
examples of fizzbuzz in rust
fn use_match() {
for i in 1..20 {
match (i%3, i%5) {
(0,0) => println!("FizzBuzz"),
(_,0) => println!("Buzz"),
(0,_) => println!("Fizz"),
(_,_) => println!("{}", i)
}
}
}
@epequeno
epequeno / fixtablet.sh
Created September 23, 2018 20:03
xrandr and xsetwacom commands to configure Wacom Cintiq Pro 13 for linux 4.18
#!/bin/bash
# rotate tablet display clockwise
#xrandr --output HDMI-1 --rotate right
# find stylus ID number
STYLUS=$(xsetwacom list devices | grep -i stylus | awk '{print $(NF-2)}')
ERASER=$(xsetwacom list devices | grep -i eraser | awk '{print $(NF-2)}')
# map wacom inputs to display
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@epequeno
epequeno / eks_config.jinja
Last active August 2, 2018 19:23
small app to get EKS cluster info from the API and print a filled out config file for ~/.kube/config from https://docs.aws.amazon.com/eks/latest/userguide/getting-started.html
apiVersion: v1
clusters:
- cluster:
server: {{endpoint_url}}
certificate-authority-data: {{cert_data}}
name: kubernetes
contexts:
- context:
cluster: kubernetes
user: aws
@epequeno
epequeno / ip_audit.py
Created July 31, 2018 14:24
audit how many IPs are in use by a list of subnets
"""subnet IP usage audit"""
# stdlib
from ipaddress import IPv4Network
# 3rd party
import boto3
# local