Skip to content

Instantly share code, notes, and snippets.

View watzon's full-sized avatar
👀
Looking for work

Chris Watson watzon

👀
Looking for work
View GitHub Profile
@watzon
watzon / waves.cr
Created April 26, 2020 22:30
Simple Wave Functions
def sine(input, amplitude, phase, frequency = nil, angular_frequency = nil)
if frequency
amplitude * Math.sin(2 * Math::PI * frequency * input + phase)
elsif angular_frequency
amplitude * Math.sin(angular_frequency * input + phase)
else
raise "Either frequency or angular_frequency is required"
end
end
@watzon
watzon / targets.txt
Last active March 27, 2020 16:47
zig targets
{
"arch": [
"arm",
"armeb",
"aarch64",
"aarch64_be",
"aarch64_32",
"arc",
"avr",
"bpfel",
{
"arch": [
"arm",
"armeb",
"aarch64",
"aarch64_be",
"aarch64_32",
"arc",
"avr",
"bpfel",
@watzon
watzon / imgmagick7-install.sh
Last active March 22, 2020 07:03
Install imagemagick7 on Debian 8
apt update
apt install -y adwaita-icon-theme autopoint build-essential chrpath cm-super-minimal dconf-gsettings-backend dconf-service debhelper dh-autoreconf dh-strip-nondeterminism doxygen doxygen-latex fontconfig fontconfig-config fonts-dejavu-core gettext ghostscript gir1.2-freedesktop gir1.2-gdkpixbuf-2.0 gir1.2-pango-1.0 gir1.2-rsvg-2.0 git glib-networking glib-networking-common glib-networking-services graphviz gsettings-desktop-schemas gsfonts hicolor-icon-theme intltool-debian libarchive-zip-perl libatspi2.0-0 libavahi-client3 libbz2-dev libcdt5 libcgraph6 libcolord2 libcroco3 libcups2 libcupsimage2 libdatrie1 libdconf1 libdjvulibre-dev libepoxy0 libexpat1-dev libfftw3-bin libfftw3-dev libfftw3-double3 libfftw3-long3 libfftw3-quad3 libfftw3-single3 libfile-stripnondeterminism-perl libfontconfig1 libfontconfig1-dev libfreetype6-dev libfribidi-dev libgd3 libgdk-pixbuf2.0-0 libgdk-pixbuf2.0-common libgdk-pixbuf2.0-dev libglib2.0-bin libglib2.0-dev libgraphite2-3 libgraphviz-dev libgs-dev libgs9 libgs9-co
@watzon
watzon / ensure_slug.cr
Created March 19, 2020 00:09
EnsureSlug Lucky Mixin
require "cadmium_transliterator"
module EnsureSlug
macro included
before_save generate_slug_if_not_exists
end
def generate_slug_if_not_exists
title.value.try do |title|
if !slug.value || slug.value.try &.empty?
@watzon
watzon / GithubStarsButton.svelte
Created July 6, 2019 20:04
Svelete/Bulma Github stars button component
<script>
import axios from 'axios';
import { onMount } from 'svelte';
export let repo;
export let text = 'Github';
let count;
onMount(async () => {
@watzon
watzon / crystal-lang.org-sitemap.json
Created June 26, 2019 20:12
Sitemap of crystal-lang.org generated with Arachnid
{
"https://crystal-lang.org": "The Crystal Programming Language",
"https://crystal-lang.org/community": "Community - The Crystal Programming Language",
"https://crystal-lang.org/blog": "Blog - The Crystal Programming Language",
"https://crystal-lang.org/2014/06/19/crystal-0.1.0-released.html": "Crystal 0.1.0 released! - The Crystal Programming Language",
"https://crystal-lang.org/api": "README - github.com/crystal-lang/crystal",
"http://crystal-lang.org/docs": "Introduction · GitBook",
"http://crystal-lang.org/installation/": "Page not found - The Crystal Programming Language",
"http://crystal-lang.org": "The Crystal Programming Language",
"http://crystal-lang.org/community": "Community - The Crystal Programming Language",
@watzon
watzon / delete-forks.cr
Created June 25, 2019 08:09
Deleting forks with octokit.cr
require "octokit"
client = Octokit.client(access_token: "***********************************0a937")
puts "Fetching repositories"
repos = client.repositories("watzon").fetch_all
puts "Selecting forks"
repos = repos.select { |r| r.fork == true }
@watzon
watzon / organization.cr
Last active June 18, 2019 23:05
Lucky Models
class Organization < BaseModel
table :organizations do
column name : String
column email : String
column profile_image_url : String?
column description : String?
column github_username : String?
column gitlab_username : String?
column twitter_username : String?
@watzon
watzon / shard.yml
Created June 17, 2019 06:31
Files for Tourmaline docker container
name: tourmaline-bot
version: 0.1.0
authors:
- Your Mane <your@email.me>
crystal: 0.28.0
dependencies:
tourmaline: