Skip to content

Instantly share code, notes, and snippets.

View atlascoder's full-sized avatar

AtlasCoder atlascoder

View GitHub Profile
@atlascoder
atlascoder / twitter_request_token.rb
Last active November 13, 2018 06:52
Twitter request_token in Ruby
require 'base64'
require 'openssl'
# 3 parameters needed
if ARGV.length == 3
API_KEY = ARGV[0]
API_SECRET_KEY = ARGV[1]
OAUTH_CALLBACK = ARGV[2]
else
puts "USAGE: ruby twitter_request_token.rb API_KEY API_SECRET_KEY OAUTH_CALLBACK"
@atlascoder
atlascoder / instruction.md
Created December 10, 2018 00:11
Create self-signed certificate with ASN (alternativeSubjectName) and without CA
  1. Create configuration file with SAN attributes san.cnf:
[req]
distinguished_name = req_distinguished_name
x509_extensions     = req_ext
prompt = no
[req_distinguished_name]
countryName = UA
stateOrProvinceName = AA
localityName = Kyiv
@atlascoder
atlascoder / README.md
Created April 26, 2021 12:08 — forked from plindberg/README.md
How to set up an AWS Lambda function for returning S3 pre-signed URLs for uploading files.

README

Granted, this is little more than an obfuscated way of having a publicly writable S3 bucket, but if you don’t have a server which can pre-sign URLs for you, this might be an acceptable solution.

For this to work, you take the following steps:

  1. Create a Lambda func, along with a new IAM role, keeping the default code.
  2. Create an API in the API Gateway.
@atlascoder
atlascoder / query-local-secondary-index.vtl
Created April 26, 2021 20:45 — forked from koingdev/query-local-secondary-index.vtl
Sample AppSync Resolver for Query Local Secondary Index
## REQUEST MAPPING
{
"version" : "2017-02-28",
"operation" : "Query",
"index": "shopID-vendorID-index",
"query" : {
"expression": "shopID = :shopID AND vendorID = :vendorID",
"expressionValues" : {
":shopID" : $util.dynamodb.toDynamoDBJson($ctx.args.shopID),
":vendorID" : $util.dynamodb.toDynamoDBJson($ctx.args.vendorID)
@atlascoder
atlascoder / c_cpp_properties.json
Last active December 2, 2021 21:09
.vscode for ESP-IDF VSCode MacOS
{
"configurations": [
{
"name": "ESP-IDF",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [],
"compilerPath": "${env.HOME}/.espressif/tools/xtensa-esp32-elf/esp-2021r2-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++",
"cStandard": "c99",
@atlascoder
atlascoder / main.c
Created February 15, 2022 12:31
GCC offsetof and va_list trick
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
// some parsing definition struct
// .offsets - offsets of structure members
typedef struct ParsingDef_t {
const char* scanfPattern;