Skip to content

Instantly share code, notes, and snippets.

View cjlarose's full-sized avatar

Chris LaRose cjlarose

View GitHub Profile
@scotttam
scotttam / apns.rb
Created January 31, 2012 15:51
Sends an Apple Push Notification with Ruby
require "rubygems"
require "yajl"
require "openssl"
require "socket"
device_token = '39cac56f 986a0e66 3c4fd4f4 68df5598 024d2ca3 8b9f307c 741c180e 9fc30c62'
device_token = device_token.gsub(" ", "")
the_byte_token = [device_token].pack("H*")
file = File.open("ruby_the_byte_token", "wb")
@akiatoji
akiatoji / gist:3044056
Created July 3, 2012 23:06
Nginx + Passenger 3 + RVM for Rack app on OS X using homebrew only

Most examples I found tell you to run rvmsudo or passenger-install-nginx-module. I ran into problems with these because:

  1. rvmsudo leaves root owned directories and files under rvm passenger gem directory. This will give you seemingly odd errors later when you try to remove/upgrade passenger gem, or try to use homebrew to install passenger.

  2. There's no good place to put nginx using passenger-install-nginx-module. Putting it under /usr/local means you have to remember it's there amongst homebrew files. Anywhere else, you still have to remember you put it there. We'd rather manage nginx install via homebrew.

So to install everything with homebrew, this is what it took:

gem install passenger
@jhass
jhass / dump_socket.sh
Last active June 11, 2024 13:15
Capture unix socket to pcap file with socat and tshark
#!/bin/bash
# Parameters
socket="/run/foo.sock"
dump="/tmp/capture.pcap"
# Extract repetition
port=9876
source_socket="$(dirname "${socket}")/$(basename "${socket}").orig"
@hopsoft
hopsoft / Gemfile
Last active August 17, 2018 20:40
Add profiling to your rake tasks.
group :development do
gem "ruby-prof"
end
@46bit
46bit / arch-systemd-rbenv-passenger-nginx.md
Last active March 21, 2017 05:26
Arch Linux and Systemd: Rbenv, Passenger and Nginx

Arch Linux and Systemd: Rbenv, Passenger and Nginx

Rbenv

git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build

export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
@taylorSando
taylorSando / material-ui-reagent.clj
Created March 12, 2015 04:10
Material UI Reagent
;; material-ui.macros.clj
(ns material-ui.macros)
(def material-tags
'[AppBar
AppCanvas
Circle
Checkbox
DatePicker
DialogWindow
@sgrove
sgrove / learn_gamma.cljs
Last active August 29, 2015 14:21
Compare "Learn WebGL Lesson 1" with "Learn Gamma Lesson 1"
;; Gamma (shader-generation): https://github.com/kovasb/gamma
;; Gamma Driver (WebGL resource management, aka "Om for WebGL"): https://github.com/kovasb/gamma-driver
;; Gamma examples: https://github.com/kovasb/gamma-examples
(ns gampg.learn-gamma.lesson-01
(:require [clojure.string :as s]
[gamma.api :as g]
[gamma.program :as p]
[gamma.tools :as gt]
[gamma-driver.drivers.basic :as driver]
@toritori0318
toritori0318 / nginx_for_production.conf
Last active December 29, 2021 19:04
nginx balancer example
worker_processes 1;
daemon off;
error_log /dev/stdout;
events {
worker_connections 1024;
}
http {
@BernCarney
BernCarney / FreeNAS11 Media Stack.md
Last active May 1, 2023 20:31
FreeNAS 11 - Jails setup for Plex, NGINX, PlexPy, Sonarr, Radarr, Jackett, Ombi, and Nzbget

FreeNAS 11 setup for Plex, PlexPy, Sonarr, Radarr, Jackett, NZBGet, Organizr, NGinx, and Ombi

I am currently working on updating this guide after updating my media server. I have added notes on things I no longer use but may update those sections in the future for users who still use them. As of now, I have everything working with the exception of Ombi and the plugins I no longer use.

@moyuanhuang
moyuanhuang / .vimrc
Last active May 10, 2022 06:48
Define vim terminal emulator's color scheme
" Add this in your ~/.vimrc
" The corresponding color matching is
" let g:terminal_ansi_colors = [
" \ '@guibase02', '@guired', '@guigreen', '@guiyellow',
" \ '@guiblue', '@guimagenta', '@guicyan', '@guibase2',
" \ '@guibase03', '@guiorange', '@guibase01', '@guibase00',
" \ '@guibase0', '@guiviolet', '@guibase1', '@guibase3'
" \]
" set the vim's terminal emulator color scheme