docker run --name recorder-redis -p 6379:6379 -d redis:alpine
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
class ProgrammersDay | |
def initialize | |
time = Time.now ; prog_day = (time.year % 4).zero? ? 12 : 13 # or prog_day = {true => 12 , false 13}[(Time.now.year % 4).zero?] | |
return puts "Today isnt programmer's day, return tomorrow =/" if (time.strftime("%d/%m/%Y") != "#{prog_day}/09/#{Time.now.year}") | |
return puts ((((RbConfig::CONFIG["host_os"] =~ /mswin32/ ? ENV["USERNAME"] : ENV["USER"]).capitalize + ", ") rescue "") + "Happy Programmer's Day") | |
end | |
end | |
ProgrammersDay.new |
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
// clone this gist to a empty folder, the run: | |
// npm init (and follow steps) | |
// npm install express --save | |
// npm install swig --save | |
// node app.js and open http://localhost:3000 | |
function App() { | |
var express = require('express'); |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
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
require 'pry' | |
require 'json' | |
require 'uri' | |
module Application | |
class NginxLogParser | |
DEFAULT_FORMAT_REGEXP = /(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\s?\-\s?-\s?\[(\d{2}\/[a-z]{3}\/\d{4}:\d{2}:\d{2}:\d{2} (\+|\-)\d{4})\]\s?\\?"?(GET|POST|PUT|HEAD|DELETE|OPTIONS)\s?(.*?)\s(HTTP\/\d\.\d)\\?"?\s?(\d{3})\s?(\d+)\s?\\?\"\-\\?\"\s?\\?\"(.*?)\"/i | |
REQUEST_FORMAT = [ |
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
killall ssh-agent; eval `ssh-agent` |
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
// node.js proxy server example for adding CORS headers to any existing http services. | |
// yes, i know this is super basic, that's why it's here. use this to help understand how http-proxy works with express if you need future routing capabilities | |
var httpProxy = require('http-proxy'), | |
express = require('express'); | |
var proxy = new httpProxy.RoutingProxy(); | |
var proxyOptions = { | |
host: '192.168.3.11', |
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 'thread' # gem install thread | |
require 'thread/pool' | |
@semaphore = Mutex.new | |
LOOPS_COUNT = (ENV['LOOPS_COUNT'] || 100).to_i | |
POOL_SIZE = (ENV['POOL_SIZE'] || LOOPS_COUNT).to_i | |
def with_thread_without_mutex!(num_loops = 100) |
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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Simple Slideshow with pure CSS3</title> | |
<style> | |
/* Document style */ | |
body * { | |
box-sizing : border-box; | |
} |
NewerOlder