Skip to content

Instantly share code, notes, and snippets.

View onedal's full-sized avatar
🎯
Focusing

mega6obep onedal

🎯
Focusing
  • Russia
View GitHub Profile
@onedal
onedal / alternative_2_steps.yml
Last active January 27, 2022 01:39
Rubygems github Open Api example
name: Ruby Gem
on:
push:
branches: [ master ]
env:
gem_version: "1.1.1000"
jobs:
@onedal
onedal / template.yml
Created November 29, 2019 04:15
SAM with graphql example
AWSTemplateFormatVersion: 2010-09-09
Description: GraphQL Example Stack
Resources:
DeploymentMarkerTagIAPO39:
Type: AWS::CloudFormation::WaitConditionHandle
Graphql:
DependsOn: DeploymentMarkerTagIAPO39
Properties:
AuthenticationType: API_KEY
LogConfig:
@onedal
onedal / install.sh
Created October 9, 2019 13:12
Script for install apps for ubuntu
# system upgrade
sudo apt update
sudo apt dist-upgrade
# visual code
sudo apt update
sudo apt install software-properties-common apt-transport-https wget
wget -q https://packages.microsoft.com/keys/microsoft.asc -O- | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main"
sudo apt update
@onedal
onedal / gist:44f894458f210fd6275ee2bfae977be7
Created August 27, 2019 05:00 — forked from ytbryan/gist:4c4db2f12f2a06b698df
fixing PG::ConnectionBad: FATAL: password authentication failed for user "postgres"
#go to hb_hba.conf
local all postgres ident
#go to psql
sudo -u postgres psql
#enter the following command to set or change the password
ALTER USER postgres PASSWORD 'actual_password';
#go to hb_hba.conf to change this line back
@onedal
onedal / abc.py
Created June 20, 2018 13:38
for you
import telebot
import requests
from telebot import types
token = ''
bot = telebot.TeleBot(token) # type: TeleBot
@bot.message_handler(commands=['start'])
def start(m):
keyboard = types.InlineKeyboardMarkup()
@onedal
onedal / dynamo_increment.rb
Created February 16, 2017 01:10
Dynamo increment for ruby
client = Aws::DynamoDB::Client.new(
region: Rails.application.secrets.dynamo_region,
credentials: Aws::Credentials.new(key,secret)
)
params = {
table_name: 'table_name',
key:{
'id': self.object_id
S3 Bucket Policy
{
"Id": "Policy1",
"Statement": [
{
"Sid": "Stmt",
"Action": [
"s3:ListBucket"
],
@onedal
onedal / puma.rb
Created August 11, 2016 07:59
puma config with worker killer
require 'puma_worker_killer'
#require 'fileutils'
rails_env = ENV['RAILS_ENV'] || 'development'
app_dir = Dir.pwd
environment rails_env
case rails_env
when 'development'
@onedal
onedal / gist:a767c341d48f9849725afabcee83736a
Created July 14, 2016 10:54
how upload code to aws lambda
==================================================================================================================
IAM -> Roles -> Create new role->lambda-s3-execution-role->AWS Service Roles->AWS Lambda->AWSLambdaExecute
and save arn
==================================================================================================================
==================================================================================================================
aws configure
==================================================================================================================
@onedal
onedal / ruby_tasks.rb
Created July 14, 2016 05:22
simple tasks
# Задание 1. Hash
# Есть массив [2,1,2,3,3,4,1], нужно из массива сделать хэш,
# у которого будет key будет значение масива, а value кол-во повторяющихся элементов return {1=>2, 2=>2,3=>2,4=>1}. Выполнить 1 строкой
# Задание 2. File
# Необходимо получить картинку по url и сохранить ее в папку проекта/скрипта, одной строчкой.
# пример url = 'http://img0.joyreactor.cc/pics/post/full/%D0%BA%D0%BE%D1%82%D1%8D-%D0%9A%D0%BB%D0%B8%D0%BA%D0%B0%D0%B1%D0%B5%D0%BB%D1%8C%D0%BD%D0%BE-%D0%BE%D0%B1%D0%BE%D0%B8-%D0%BA%D1%80%D0%B0%D1%81%D0%B8%D0%B2%D1%8B%D0%B5-%D0%BA%D0%B0%D1%80%D1%82%D0%B8%D0%BD%D0%BA%D0%B8-2629498.jpeg'
# Задание 3. Работа с орм(activerecord)
# Существует таблица Users с атрибутами(email, password, nick_name) получить всех юзеров у который email not null и начинается с символа 'a'