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
## | |
# Host Database | |
# | |
# localhost is used to configure the loopback interface | |
# when the system is booting. Do not change this entry. | |
## | |
127.0.0.1 localhost | |
255.255.255.255 broadcasthost | |
::1 localhost | |
fe80::1%lo0 localhost |
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
#include<iostream> | |
#include<vector> | |
using namespace std; | |
int main() | |
{ | |
int sought = 4e8; | |
vector<int> vec; | |
for(size_t i = 0; i < sought + 20; i++) |
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
#include<iostream> | |
#include<vector> | |
using namespace std; | |
typedef long long ll; | |
ll n; | |
vector<int> numbers; | |
struct Tree { |
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
#include<iostream> | |
#include<vector> | |
using namespace std; | |
typedef long long ll; | |
struct Tree { | |
vector<ll> tree; | |
ll n; |
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/bash | |
at $2 << !! | |
say $1 | |
osascript -e 'tell app "System Events" to display dialog "Reminder: $1"' | |
!! | |
exit 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
# fibonacci | |
h = Hash.new { |hash,key| hash[key] = hash[key-1] + hash[key-2] } | |
h[1] = 0 | |
h[2] = 1 |
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 "net/https" | |
require "uri" | |
require 'json' | |
def request(url) | |
uri = URI.parse(url) | |
http = Net::HTTP.new(uri.host, uri.port) | |
http.use_ssl = true | |
http.verify_mode = OpenSSL::SSL::VERIFY_NONE |
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
if defined? ActiveRecord | |
def explain(query) | |
query = query.to_sql if query.is_a?(ActiveRecord::Relation) | |
ActiveRecord::Base.connection | |
.execute("EXPLAIN ANALYZE #{query}") | |
.to_a | |
.each { |hash| puts hash["QUERY PLAN"] } | |
nil |
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
# requires root permissions in /usr/bin/ | |
star = String.new | |
8.times { star += "*" } | |
Star = "\n#{star * 3}\n" | |
def newblock string | |
puts "\n#{Star}#{string}#{Star}\n" | |
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/bash | |
# | |
# Launches sshuttle if you're on an untrusted network, currently only available on OS X. | |
# Patches for Linux support welcome! | |
# | |
# sshutle: Transparent proxy server that works as a poor # man's VPN. | |
# Forwards over ssh. Doesn't require admin. Works with Linux and MacOS. Supports DNS tunneling. | |
# https://github.com/apenwarr/sshuttle | |
# | |
# Dependencies |