This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
# output compression saves bandwidth | |
gzip on; | |
gzip_http_version 1.1; | |
gzip_vary on; | |
gzip_comp_level 6; | |
gzip_proxied any; | |
gzip_types text/plain text/html text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; | |
# make sure gzip does not lose large gzipped js or css files |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### blogged @ http://dojo4.com/blog/easy-cheasy-realtime-log-tailing-in-a-rails-admin-view | |
### the su controller action | |
def logs | |
log = File.join(Rails.root, "log", "#{ Rails.env }.log") | |
@lines = `tail -1024 #{ log }`.split(/\n/).reverse |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require "openssl" | |
class BF < Struct.new(:key, :pad_with_spaces) | |
def encrypt(str) | |
cipher = OpenSSL::Cipher.new('bf-ecb').encrypt | |
if pad_with_spaces | |
str += " " until str.bytesize % 8 == 0 | |
cipher.padding = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'lograge' # more readable logs | |
gem 'logstash-event' # for logstash json format | |
gem 'mono_logger' # threadsafe logging |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
******************************************************************************** | |
Golang - Asterisk and Ampersand Cheatsheet | |
******************************************************************************** | |
Also available at: https://play.golang.org/p/lNpnS9j1ma | |
Allowed: | |
-------- | |
p := Person{"Steve", 28} stores the value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from keras.models import Sequential | |
from keras.layers.core import Dense, Dropout, Activation | |
from keras.optimizers import SGD | |
import numpy as np | |
X = np.array([[0,0],[0,1],[1,0],[1,1]]) | |
y = np.array([[0],[1],[1],[0]]) | |
model = Sequential() | |
model.add(Dense(8, input_dim=2)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MIX_ENV=prod mix compile.protocols | |
MIX_ENV=prod PORT=4001 elixir -pa _build/prod/consolidated -S mix phoenix.server |