Skip to content

Instantly share code, notes, and snippets.

View svenyurgensson's full-sized avatar

Yury Batenko svenyurgensson

View GitHub Profile
@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
@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)
});

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
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));
@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)

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 / 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
@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 / XORCipher.js
Created March 28, 2017 06:33 — forked from sukima/XORCipher.js
A Super simple encryption cipher using XOR and Base64 in JavaScript
// XORCipher - Super simple encryption using XOR and Base64
//
// Depends on [Underscore](http://underscorejs.org/).
//
// As a warning, this is **not** a secure encryption algorythm. It uses a very
// simplistic keystore and will be easy to crack.
//
// The Base64 algorythm is a modification of the one used in phpjs.org
// * http://phpjs.org/functions/base64_encode/
// * http://phpjs.org/functions/base64_decode/
@svenyurgensson
svenyurgensson / rails http status codes
Created October 13, 2017 04:10 — forked from mlanett/rails http status codes
HTTP status code symbols for Rails
HTTP status code symbols for Rails
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings.
Status Code Symbol
1xx Informational
100 :continue
101 :switching_protocols
102 :processing