Skip to content

Instantly share code, notes, and snippets.

View amanelis's full-sized avatar
🧙‍♀️

amanelis

🧙‍♀️
View GitHub Profile
@amanelis
amanelis / fremont_covid_vaccine.rb
Created April 11, 2021 17:35
A quick ruby script for checking COVID-19 Vaccine in Fremont, California
require 'rubygems'
require 'nokogiri'
require 'open-uri'
puts "COVID Vaccine Finder / Fremont, California"
page = Nokogiri::HTML(open(URL))
mDiv = "body > div > div.shadow-sm.p-3.mb-4.rounded > div:nth-child(8) > div"
bDiv = "button"
@amanelis
amanelis / EIP712.sol
Created March 5, 2021 22:26 — forked from anubhavgirdhar/EIP712.sol
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.6.6+commit.6c089d02.js&optimize=false&gist=
pragma solidity ^0.5.0;
contract EIP712 {
mapping(address => uint256) public nonces;
struct EIP712Domain {
string name;
string version;
uint256 chainId;
@amanelis
amanelis / Makefile
Last active January 15, 2020 18:27
Makefile for Minikube
# Minikube local development
################################################################################
minikube-up: minikube-start minikube-install
minikube-down: minikube-uninstall minikube-delete
setup_dashboard:
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0-beta6/aio/deploy/recommended.yaml
minikube-dashboard:
@minikube dashboard
@amanelis
amanelis / alembic.ini
Created January 16, 2019 18:42
Better migration file naming for Alembic
[alembic]
# path to migration scripts
script_location = alembic
# template used to generate migration files
file_template = %%(year)d%%(month).2d%%(day).2d%%(hour).2d%%(minute).2d%%(second).2d_%%(rev)s_%%(slug)s
# timezone to use when rendering the date
# within the migration file as well as the filename.
# string value is passed to dateutil.tz.gettz()
@amanelis
amanelis / garage.py
Last active February 19, 2020 19:00
My raspberryPI python Twilio code to trigger a command / garage door
import time
import datetime
from datetime import date
from twilio.rest import Client
from subprocess import call
print("Garage loop, starting...")
client = Client('account_sid', 'account_token')
@amanelis
amanelis / go_async_stock_prices.go
Created October 5, 2017 18:28
Golang async stock quote fetcher
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"sync"
"time"

Keybase proof

I hereby claim:

  • I am amanelis on github.
  • I am amanelis (https://keybase.io/amanelis) on keybase.
  • I have a public key whose fingerprint is D8B5 3805 923F BBC3 E07E 8988 5A85 9D7E 303F 49EF

To claim this, I am signing this object:

@amanelis
amanelis / stock_prices.rb
Last active June 24, 2016 16:27
Stock prices with a bonus of Bitcoin at the end
require 'json'
require 'open-uri'
class Stocks
def self.get_by_symbols(symbols)
return symbols.inject([]) { |memo, sym|
result = JSON.parse(open("http://dev.markitondemand.com/MODApis/Api/v2/Quote/json?symbol=#{sym}").read)
memo << {symbol: result['Symbol'], lastPrice: result['LastPrice']}
}
end
@amanelis
amanelis / toggle_swap
Created April 19, 2015 21:04
toggles and cleans a unix swap
#!/bin/bash
free_data="$(free)"
mem_data="$(echo "$free_data" | grep 'Mem:')"
free_mem="$(echo "$mem_data" | awk '{print $4}')"
buffers="$(echo "$mem_data" | awk '{print $6}')"
cache="$(echo "$mem_data" | awk '{print $7}')"
total_free=$((free_mem + buffers + cache))
used_swap="$(echo "$free_data" | grep 'Swap:' | awk '{print $3}')"
@amanelis
amanelis / object_space.rb
Created January 16, 2015 23:45
Count the instances of an object in the code.
class Examp
def self.obj_count
count = 0
ObjectSpace.each_object(self) do |b|
count += 1
end
return count
end
end