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
/****************** | |
* minesweeper.js * | |
****************** | |
* | |
* So much for Asimov's Laws. They're actually trying to kill | |
* you now. Not to be alarmist, but the floor is littered | |
* with mines. Rushing for the exit blindly may be unwise. | |
* I need you alive, after all. | |
* | |
* If only there was some way you could track the positions |
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 "test/unit" | |
class Array | |
def fifo | |
verbrauch = inject(0) {|sum, el| sum+=el.abs if el < 0; sum } | |
res = select{|el| el > 0}.inject([]) do |result, el| | |
if el > verbrauch | |
result << (el - verbrauch) | |
verbrauch = 0 | |
else |
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
build/ |
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 'sinatra/base' | |
require 'forwardable' | |
class I18n | |
def self.t(s); "I18n.t(#{s})"; end | |
def self.l(s); "I18n.l(#{s})"; end | |
end | |
class App < Sinatra::Base | |
extend Forwardable |
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
namespace :admin do | |
desc "creates and admin user" | |
task :create => :environment do | |
line = HighLine.new # a command line lib that uses erb? Bizarre. | |
line.say "<%= color('Creating a new administrative user', BOLD) %>" | |
email = line.ask("Email: ") | |
pass = line.ask("Password: " ) { |q| q.echo = "*" } | |
admin = Admin.new(:email => email, :password => pass) |
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
The MIT License (MIT) | |
Copyright (c) 2015 Oleg Ivanov http://github.com/morhekil | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: |
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
God.watch do |w| | |
w.name = "mysqld" | |
w.interval = 30.seconds # default | |
w.start = "service mysql start" | |
w.stop = "service mysql stop" | |
w.restart = "service mysql restart" | |
w.start_grace = 20.seconds | |
w.restart_grace = 20.seconds | |
w.pid_file = "/var/lib/mysql/hostname.pid" | |
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 coffee | |
# | |
# install on ubuntu: | |
# sudo apt-get install automake autoconf libpcap-dev zlib1g-dev libboost-dev libcairo2-dev | |
# | |
# cd /tmp/ | |
# git clone --recursive -b tcpflow-1.4.4 git@github.com:simsong/tcpflow.git tcpflow/ | |
# cd tcpflow/ | |
# | |
# sh bootstrap.sh |
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 bash | |
# Must be run as root / sudo | |
# Reference: https://askubuntu.com/questions/966585/ubuntu-17-10-upgrade-broke-vmware-workstation-12-5 | |
if [ $(dpkg-query -W -f='${Status}' linux-headers-generic 2>/dev/null | grep -c "ok installed") -eq 0 ]; | |
then | |
echo "Kernel Headers Package Missing" | |
echo "apt-get install linux-headers-generic"; | |
exit 1 | |
fi |
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 | |
#-*- encoding: utf-8 -*- | |
# http://blog.evernote.com/tech/2013/08/08/evernote-export-format-enex/ | |
require 'nokogiri' | |
require 'date' | |
require 'ostruct' | |
class Note < OpenStruct; end |
OlderNewer