Skip to content

Instantly share code, notes, and snippets.

@PrzemekMalak
PrzemekMalak / CPWifiNetwork.m
Last active December 15, 2015 06:39
Get Current WiFi Network
+(NSDictionary *) getCurrentNetwork
{
NSMutableDictionary *_hn;
NSArray *netArray = (__bridge_transfer id)CNCopySupportedInterfaces();
id info = nil;
for (NSString *netName in netArray)
{
info = (__bridge_transfer id)CNCopyCurrentNetworkInfo((__bridge CFStringRef)netName);
NSDictionary *infoDictionary = (NSDictionary*) info;
from azure.storage.queue import QueueService
# tworzymy usługę
queue_service = QueueService(account_name='nazwa konta', account_key='klucz api')
# tworzymy kolejkę
queue_service.create_queue('testqueue')
# wysyłamy jedną wiadomość, która zniknie po 30 sekundach
# queue_service.put_message('testqueue', 'Moja pierwsza wiadomość', 0, 30, 30)
import boto3
import hashlib
sqs = boto3.resource('sqs', region_name='eu-west-1')
queue_name = 'FifoQueue.fifo'
# tworzymy kolejkę wiadomości FIFO
queue_create = sqs.create_queue(QueueName=queue_name, Attributes={'FifoQueue':'true', 'ContentBasedDeduplication': 'true'})
queue = sqs.get_queue_by_name(QueueName=queue_name)
using Amazon.SimpleSystemsManagement;
using Amazon.SimpleSystemsManagement.Model;
using System.Threading.Tasks;
namespace AWSParameterStore
{
public class ParameterAWSStore
{
private static readonly string databaseString = "DATABASE_HOST";
private static readonly string databaseName = "DATABASE_NAME";
@PrzemekMalak
PrzemekMalak / gist:b96c58003435cbfa9e507b9e29057a78
Created January 27, 2019 16:59
dynamodb_encode_decode.py
boto3.resource('dynamodb')
# Decode DynamoDB response to python
deserializer = boto3.dynamodb.types.TypeDeserializer()
data = {k: deserializer.deserialize(v) for k,v in low_level.items()}
# Encode python to DynamoDb low level format
serializer = boto3.dynamodb.types.TypeSerializer()
low_level = {k: serializer.serialize(v) for k,v in data.items()}
AWSTemplateFormatVersion: 2010-09-09
Parameters:
Prefix:
Type: String
VPCCIDR:
Type: String
Default: 10.0.0.0/16
AllowedPattern: '^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$'
@PrzemekMalak
PrzemekMalak / epub2mp3.py
Last active April 18, 2023 20:30
Converting epub file into mp3 audiobook. Example for my blog post (in Polish) https://abcserverless.pl/polly-zrobi-nam-audiobooka/
import textwrap
from epub_conversion.utils import convert_epub_to_lines, convert_lines_to_text, open_book
import boto3
from contextlib import closing
from pydub import AudioSegment
import os
def split_epub(book_name):
book = open_book(book_name)