Skip to content

Instantly share code, notes, and snippets.

View maatthc's full-sized avatar

Alexandre Andrade maatthc

  • MaaT Tech
  • Melbourne
View GitHub Profile
@maatthc
maatthc / topN.py
Last active June 16, 2017 10:25
Read numbers from a big file and present the N largest numbers
#!/usr/bin/python
from sys import argv
import multiprocessing as mp
import time
# Ajust for number of cpus/memory
# Each process will sort an array of size : ratio_per_process * size_array_largest
ratio_per_process = 30000
# Lets consolidate the Sort after some number of interations
num_interations = 50
@maatthc
maatthc / generate_big_file.py
Created June 16, 2017 10:28
Generates a file with one random number per line.
#!/usr/bin/env python
from sys import argv, exit
import random
big_file_name = "big_file.txt"
max_size_of_number = 1000000
random.seed(123)
if len(argv) != 2:
print "Usage: %s Num_Lines" % __file__
import serial
import kivy
from kivy.app import App
from kivy.clock import Clock
from kivy.core.window import Window
from kivy.uix.scrollview import ScrollView
from kivy.uix.gridlayout import GridLayout
from kivy.properties import ObjectProperty, StringProperty
var CardIO = null;
try {
CardIO = UIViewController.extend({
setup: function() {
CardIOUtilities.preload();
},
init: function() {
var self = this.super.init();
if (self) {
@maatthc
maatthc / nativescript_androidStudio.sh
Created May 14, 2018 06:44
How to integrate Android Studio without SDK to NativeScript without sudo
# Download the "Android Studio" (version 3.2.1 as today) from
# https://developer.android.com/studio/#downloads
# Extract and move to the Desktop
# Download the "Command line tools only" from the same page
# Extrat to ~/Downloads and then:
cd ~/Desktop/Android\ Studio.app/
mv ~/Downloads/tools ./
# Download the "SDK Platform Tools" from
### BEGIN INIT INFO
# Provides: access-point
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Control hostapd access point
# Description: Control hostapd Wifi access point on Raspberry Pi 3 running Kali Linux
### END INIT INFO
MENUDIR=./
@maatthc
maatthc / aws_sam_template.yml
Created March 13, 2019 22:57
Basic AWS SAM template to run NodeJs Lambdas locally: sam local invoke -t sam_template.yml -e test/fixtures/s3-to-lambda-put-event.json
AWSTemplateFormatVersion : '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Resources:
LambdaFunction:
Type: AWS::Serverless::Function
Properties:
Handler: index.handler
Runtime: nodejs8.10
MemorySize: 128
Timeout: 15
AWSTemplateFormatVersion: "2010-09-09"
Description: "An example lambda template to demonstrate persistent state between executions"
Resources:
LambdaExecutionRole:
Type: "AWS::IAM::Role"
Properties:
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: Allow
@maatthc
maatthc / api-gw-template.yml
Last active October 13, 2023 14:52
AWS CloudFormation template example for allowing uploading files to S3 via API Gateway
AWSTemplateFormatVersion: '2010-09-09'
Parameters:
ApiGatewayStack:
Description: The stack where the api gateway rest api is defined
Type: String
Default: dev-maat-apigw-app
EventBucket:
Type: String
Default: dev-maat-bucket
CorsAllowOrigin:
@maatthc
maatthc / sad.js
Last active November 19, 2022 09:25
Search and Destroy - Free up disk space deleting "node_modules" folders recursively
#!/usr/bin/env node
// Search and Destroy
//
const path = require('path')
const fs = require('fs')
const createPackageJson = () => {
const packageJsonContent = `
{
"name": "sad",