Skip to content

Instantly share code, notes, and snippets.

View hadees's full-sized avatar

Evan Alter hadees

  • inKind
  • Austin, TX
View GitHub Profile
@palkan
palkan / Gemfile
Last active April 25, 2024 14:23
RSpec profiling with RubyProf and StackProf
gem 'stackprof', require: false
gem 'ruby-prof', require: false
@Dreyer
Dreyer / perlbrew_libgcc_s.txt
Created January 20, 2017 11:27
[perlbrew] ld: library not found for -lgcc_s.10.4
$ cd /usr/local/lib
$ sudo ln -s ../../lib/libSystem.B.dylib libgcc_s.10.5.dylib
$ sudo ln -s ../../lib/libSystem.B.dylib libgcc_s.10.4.dylib
@AhmedNadar
AhmedNadar / application_controller.rb
Last active November 30, 2023 00:43
How to redirect to a 404 in Rails?
# app/controllers/application_controller.rb
class ApplicationController < ActionController::Base
def not_found
raise ActionController::RoutingError.new('Not Found')
rescue
render_404
end

Validate JSON schema in Rails

Topics

  1. What/Why JSON schema
  2. Apply to rails model validation
  3. Test your API endpoint with schema matcher
  4. Homework for a curious reader
  5. References
@rsaxvc
rsaxvc / interfaces
Last active March 15, 2021 04:48
/etc/network/interfaces file for Linux router
# This file describes how to configure a Linux computer as a router for GoogleFiber.
# References:
# https://wiki.debian.org/NetworkConfiguration#Bridges_and_VLANs
# https://wiki.debian.org/BridgeNetworkConnections#Configuring_bridging_in_.2Fetc.2Fnetwork.2Finterfaces
# http://flyovercountry.org/2014/02/google-fiber-gigabit-speeds-your-router-part-2-qos/
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
@lightonphiri
lightonphiri / bash-install_google_fonts_on_ubuntu.md
Last active April 4, 2025 23:39
Install Google Fonts on Ubuntu

Install Google Fonts

Download desired fonts

https://fonts.google.com/?selection.family=Open+Sans

Install Google Fonts on Ubuntu

cd /usr/share/fonts
sudo mkdir googlefonts
cd googlefonts
sudo unzip -d . ~/Downloads/Open_Sans.zip

@tzmartin
tzmartin / embedded-file-viewer.md
Last active April 16, 2025 14:36
Embedded File Viewer: Google Drive, OneDrive

Office Web Apps Viewer

('.ppt' '.pptx' '.doc', '.docx', '.xls', '.xlsx')

http://view.officeapps.live.com/op/view.aspx?src=[OFFICE_FILE_URL]

<iframe src='https://view.officeapps.live.com/op/embed.aspx?src=[OFFICE_FILE_URL]' width='px' height='px' frameborder='0'>
</iframe>

OneDrive Embed Links

@jgrau
jgrau / update-all-gems
Created August 15, 2016 14:28
A ruby script to update all gems one by one; running tests between each updated gem and committing to git.
#!/usr/bin/env ruby
# Makes accessing the latest exitstatus a bit easier
require 'English'
# Updates all the outdated gems one by one and commits the changes
# for every gem update. This should make it a lot easier to revert
# a gem update.
class UpdateAllGems
def self.run
#!/bin/bash -e
ln -s /usr/lib/x86_64-linux-gnu/amdgpu-pro .
ln -s /etc/OpenCL .
tar -czvf libs.tar.gz amdgpu-pro/*
tar -czvf conf.tar.gz OpenCL/*
cat > .dockerignore << EOF
OpenCL