Skip to content

Instantly share code, notes, and snippets.

View svenyurgensson's full-sized avatar

Yury Batenko svenyurgensson

View GitHub Profile
@svenyurgensson
svenyurgensson / sync-postgres-mina.rb
Created June 10, 2016 12:45 — forked from nicolai86/sync-postgres-mina.rb
sync down the content of a postgresql database used by a rails application using mina.
RYAML = <<-BASH
function ryaml {
ruby -ryaml -e 'puts ARGV[1..-1].inject(YAML.load(File.read(ARGV[0]))) {|acc, key| acc[key] }' "$@"
};
BASH
namespace :sync do
task :db do
isolate do
invoke :environment
@svenyurgensson
svenyurgensson / db.rake
Created February 25, 2016 04:55 — forked from hopsoft/db.rake
Rails rake tasks for dump & restore of PostgreSQL databases
# lib/tasks/db.rake
namespace :db do
desc "Dumps the database to db/APP_NAME.dump"
task :dump => :environment do
cmd = nil
with_config do |app, host, db, user|
cmd = "pg_dump --host #{host} --username #{user} --verbose --clean --no-owner --no-acl --format=c #{db} > #{Rails.root}/db/#{app}.dump"
end
puts cmd

Minecraft Ultimate Tool Set

Requires creative mode or operator power on a multiplayer server. On a single player game (survival or hardcore), you will need "cheats" enabled to move into creative mode. Don't forget to leave creative mode when done.

These items might be stupid. Be prepared to repair the country-side.

@svenyurgensson
svenyurgensson / crypto-wrong-answers.md
Created November 26, 2015 08:11 — forked from paragonie-scott/crypto-wrong-answers.md
An Open Letter to Developers Everywhere (About Cryptography)
self.addEventListener('fetch', async (event) => {
const response = await fetch(event.request);
const cache = await caches.open('cache-v1');
if (response.ok === true) {
cache.put(event.request, response);
event.respondWith(response);
} else {
event.respondWith(cache.match(event.request));

System

  1. Set up iCloud Keychain
  2. Remove icons and hide Dock
  3. Default address in iMessage
  4. Install Updates
  5. Add Ru Input Sources
  6. Set up Shortcuts
  7. Add text shortcuts Text
@svenyurgensson
svenyurgensson / functions.js
Last active August 29, 2015 14:25 — forked from RedBeard0531/functions.js
Min, Max, Sum, Count, Avg, and Std deviation using MongoDB MapReduce
// derived from http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Parallel_algorithm
function map() {
emit(1, // Or put a GROUP BY key here
{sum: this.value, // the field you want stats for
min: this.value,
max: this.value,
count:1,
diff: 0, // M2,n: sum((val-mean)^2)
});
@svenyurgensson
svenyurgensson / 0_reuse_code.js
Created June 6, 2014 17:21
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
Check out README.md to get started editing Clojure with Emacs.