Skip to content

Instantly share code, notes, and snippets.

View pocheptsov's full-sized avatar

slava pocheptsov pocheptsov

View GitHub Profile
@ramimac
ramimac / Cloud Security Orienteering Checklist.md
Last active April 24, 2024 03:54
A Checklist of Cloud Security Orienteering

Cloud Security Orienteering: Checklist
by Rami McCarthy
via TL;DR sec

How to orienteer in a cloud environment, dig in to identify the risks that matter, and put together actionable plans that address short, medium, and long term goals.

Based on the Cloud Security Orienteering methodology.

Checklist

@GustavoCaso
GustavoCaso / job_scheduler_using_ractor.rb
Last active January 5, 2021 04:30
Simple implementation for a job scheduler using ruby Ractor primitive
# How to install the latests version of ruby
# 1. clone ruby/ruby
# 2. autoconf
# 3. ./configure
# 4. cd ext/openssl && ruby extconf.rb --with-openssl-dir=<openssl_root>; make; make install
# 5. cd ../../
# 6. make
# 7. make install-nodoc
# You should be ready ti run this script!!!!
@coltenkrauter
coltenkrauter / fix-wsl2-dns-resolution
Last active July 28, 2024 04:05
Fix DNS resolution in WSL2
More recent resolution:
1. cd ~/../../etc (go to etc folder in WSL).
2. echo "[network]" | sudo tee wsl.conf (Create wsl.conf file and add the first line).
3. echo "generateResolvConf = false" | sudo tee -a wsl.conf (Append wsl.conf the next line).
4. wsl --terminate Debian (Terminate WSL in Windows cmd, in case is Ubuntu not Debian).
5. cd ~/../../etc (go to etc folder in WSL).
6. sudo rm -Rf resolv.conf (Delete the resolv.conf file).
7. In windows cmd, ps or terminal with the vpn connected do: Get-NetIPInterface or ipconfig /all for get the dns primary and
secondary.
class ActiveRecord::Relation
# Preload one level a chained association whose name is specified in attribute.
def preload_chain(attribute, collection: nil)
preloader = ActiveRecord::Associations::Preloader.new
preloader.preload(collection || records, attribute.to_sym)
self
end
# Preload all levels of a chained association specified in attribute. Will cause infinite loops if there are cycles.
def deep_preload_chain(attribute, collection: nil)
@mdo
mdo / 00-intro.md
Last active June 25, 2024 18:16
Instructions for how to affix an Ikea Gerton table top to the Ikea Bekant sit-stand desk frame.

Ikea Bekant standing desk with Gerton table top

@dgg
dgg / build.js
Last active August 23, 2017 14:48
automating-phonegap-builds-with-gulp
gulp.task('build', gulpsync.sync(['unlock', 'compress']), function () {
var endpoint = '/apps/' + config.phoneGap.appId;
var env = config.ensure.environment(argv.env, argv.debugmode);
pgBuild.auth({ token: config.phoneGap.authToken }, function (e, api) {
gulp.src('tmp/*.zip').pipe(tap(function (file, t) {
var options = {
form: {
data: {
@senko
senko / maybe.py
Last active May 2, 2024 18:35
A Pythonic implementation of the Maybe monad
# maybe.py - a Pythonic implementation of the Maybe monad
# Copyright (C) 2014. Senko Rasic <senko.rasic@goodcode.io>
#
# 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:
#
@yevhen
yevhen / gist:5199613
Created March 19, 2013 20:07
The concept of message handling Component and the example of message handler chaining via functional composition
/* somewhere in your Core.CQRS */
// Base class for all ES-based aggregate command handling components;
//
// NOTE: "Component" is a logical grouping of message handlers by function
// They provide good place to encapsulate chaining of cross-cutting concerns
// into a pipeline, providing simplified helper methods for registration of message handlers
//
// Components are similar to Services, thus they only contain handlers of single type (ie Command Handlers only)
// Components operate on envelope (infrastructure) level
@anvaka
anvaka / quine1.js
Last active December 12, 2015 10:18
Just having fun... This function prints itself to the console.
(function () {
var arr = ["(function () {", "var arr = [", "arr[1] += arr.map(function(x) { return String.fromCharCode(0x22) + x + String.fromCharCode(0x22); }).join(', ') + '];';", "arr.forEach(function(x) { console.log(x); });", "}())"];
arr[1] += arr.map(function(x) { return String.fromCharCode(0x22) + x + String.fromCharCode(0x22); }).join(', ') + '];';
arr.forEach(function(x) { console.log(x); });
}())