Skip to content

Instantly share code, notes, and snippets.

View tbjers's full-sized avatar
🙃

Torgny Bjers tbjers

🙃
View GitHub Profile
@JannieT
JannieT / calendar.py
Last active January 10, 2022 05:22
MagTag Calendar
import rtc
import time
import board
from adafruit_magtag.magtag import MagTag
from adafruit_oauth2 import OAuth2
from adafruit_bitmap_font import bitmap_font
from adafruit_display_text import label
class Calendar:
@davialexandre
davialexandre / gruvbox_dark.json
Created June 23, 2019 18:09
Gruvbox Dark color scheme for the new Windows Terminal
{
"background" : "#282828",
"black" : "#282828",
"blue" : "#458588",
"brightBlack" : "#928374",
"brightBlue" : "#83A598",
"brightCyan" : "#8EC07C",
"brightGreen" : "#B8BB26",
"brightPurple" : "#D3869B",
"brightRed" : "#FB4934",
@bvandgrift
bvandgrift / attribute_requirements.rb
Created February 28, 2016 03:46
a terrible way to determine whether attrs on an ActiveRecord model are optional or required when using grape.
module AttributeRequirements
extend ActiveSupport::Concern
SQL_TYPE_MATCHERS = {
/^character varying/ => String,
/^text/ => String,
/^enum/ => String,
/^timestamp/ => DateTime,
/^integer/ => Integer,
@ciscoheat
ciscoheat / Vagrantfile
Last active May 21, 2016 01:45
Vagrant setup for c5
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
@shrop
shrop / intro-meteor.js.md
Last active October 1, 2022 16:54
Introduction to Meteor.js
@matb33
matb33 / README.md
Created August 28, 2013 01:17
Meteor Template layouts with yield keyword, inspired by Iron Router. Will eventually make a proper repo and port to Meteorite... stay tuned

Meteor Template layouts with yield

Example usage:

Layout.helper("modal", function (options) {
  return {
    bgcolor: options.bgcolor || "#fff",
    layout: options.layout || "modalLayout"
 };

Displaying images in the terminal with tput and echo

output

Requires ImageMagick, easily available from your favorite package manager. Tested on Linux and OSX
convert image.png -resize 40 txt:-|sed -E 's/://;s/\( ? ?//;s/, ? ?/,/g;s/\)//;s/([0-9]+,[0-9]+,[0-9]+),[0-9]+/\1/g;s/255/254/g;/mage/d'|awk '{print $1,$2}'|sed -E 's/^0,[0-9]+ /print "echo;tput setaf "\;/;s/^[0-9]+,[0-9]+ /print "tput setaf ";/;s/(.+),(.+),(.+)/\1\/42.5*36+\2\/42.5*6+\3\/42.5+16/'|bc|sed 's/$/;echo -n "  ";/'|tr '\n' ' '|sed 's/^/tput rev;/;s/; /;/g;s/$/tput sgr0;echo/'|bash
1 leek plant
1 bushel of asparagus
2 cups veggie broth
1 table spoon Butter
1 table spoon olive oil
Salt & pepper
First cut leek and asparagus into smaller less then 2 inch pieces.
Melt butter with olive oil
@codeforkjeff
codeforkjeff / solarize.sh
Created November 27, 2011 06:43
shell script for setting gnome-terminal color palette to use Solarized theme
#!/bin/sh
#
# Shell script that configures gnome-terminal to use solarized theme
# colors. Written for Ubuntu 11.10, untested on anything else.
#
# Solarized theme: http://ethanschoonover.com/solarized
#
# Adapted from these sources:
# https://gist.github.com/1280177
# http://xorcode.com/guides/solarized-vim-eclipse-ubuntu/
@andyedinborough
andyedinborough / jquery.oauth.js
Created June 7, 2011 19:30
Introduces $.oauth() to make using OAuth from jQuery as easy as using $.ajax()
(function (window, document, $, undefined) {
if (!$.Deferred) throw 'jQuery 1.5 is required to use the jQuery.oauth script!';
function require(name, url) {
if (window[name] === undefined)
return $.ajax({ type: 'GET', cache: true, dataType: 'script', url: url });
}
$.oauth = function (options) {
var d = $.Deferred();