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
$tail -100f /var/log/applications/application.log | awk ' | |
/INFO/ {print "\033[32m" $0 "\033[39m"} | |
/Exception/ {print "\033[31m" $0 "\033[39m"} | |
' |
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
// https://gist.github.com/mateuspv/45bfb3e10a84e34b0074 | |
/** | |
Sweet.js version: 0.7.2 | |
`this` nickname `@` | |
Expected: | |
@ -> this | |
@something -> this.something | |
example: | |
function hello (tag) { |
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
[ | |
{ "keys": ["ctrl+alt+super+d"], "command": "toggle_side_bar" }, | |
{ "keys": ["super+l"], "command": "show_overlay", "args": {"overlay": "goto", "text": ":"} }, | |
{ "keys": ["super+shift+l"], "command": "expand_selection", "args": {"to": "line"} }, | |
{ "keys": ["ctrl+super+r"], "command": "reveal_in_side_bar" }, | |
{ "keys": ["alt+shift+up"], "command": "select_lines", "args": {"forward": false} }, | |
{ "keys": ["alt+shift+down"], "command": "select_lines", "args": {"forward": true} }, | |
{ "keys": ["ctrl+shift+<"], "command": "erb" }, | |
{ "keys": ["super+shift+t"], "command": "reopen_last_file" }, | |
{ "keys": ["super+i"], "command": "copy_path" }, |
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
# -*- coding: utf-8 -*- | |
source 'https://rubygems.org' | |
gem "pry", group: 'development' | |
gem "bunny", ">= 2.1.0" | |
gem "redlock" |
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
{ title: "My ER Diagram" } | |
# Tables | |
[User] { color: :blue } | |
*id | |
blog_id* <nullable> | |
name | |
[Blog] { color: :orange } | |
*id |
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
str = " [ = This message will self destruct = ]" | |
wave = -> max { [*0.upto(max), *max.downto(0)] } | |
puts | |
wave[str.length].each do |char| | |
sleep(0.05) | |
print "\r\e[2K#{str[0..char]}" | |
end | |
print "\e[M\e[1A\r" |
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
# http://stackoverflow.com/a/9380164/1171712 | |
module MyFancyApp | |
class Application < Rails::Application | |
config.log_tags = [:uuid, :remote_ip] | |
end | |
end |
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
#!/bin/sh | |
sudo mv /usr/bin/xdg-open /usr/bin/xdg-open.bak | |
sudo curl https://gist.github.com/weapp/4717249/raw/16b3ce7ae4c4e63162ca0d9e47b2805d410bfa14/xdg-open.rb -o /usr/bin/xdg-open | |
sudo chmod a+x /usr/bin/xdg-open |
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 collections import Iterable | |
import numpy as np | |
import math | |
class LogQueue(object): | |
"""Collection for store a degradable history""" | |
def __init__(self, size=5, depth=1): | |
super(LogQueue, self).__init__() | |
self.items = [] |
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 'securerandom' | |
require 'benchmark/ips' | |
hashs = 20.times.map do | |
20.times.map { [SecureRandom.hex(2), SecureRandom.hex(2)] }.to_h | |
end | |
Benchmark.ips do |x| | |
x.time = 5 | |
x.warmup = 2 |