Skip to content

Instantly share code, notes, and snippets.

View alanjds's full-sized avatar

Alan Justino da Silva alanjds

  • Santo André, São Paulo/SP - Brazil
View GitHub Profile
@julianxhokaxhiu
julianxhokaxhiu / README.md
Last active December 5, 2023 07:52
Enable autodiscover AirPlay Client support on Arch Linux ( like on macOS )

Enable autodiscover AirPlay Client support on Arch Linux ( like on macOS )

Step 1

Install required dependencies

$ pacman -S avahi pulseaudio-zeroconf

Step 2

@weakish
weakish / doctest.md
Created November 4, 2018 15:33
#survey of #Ruby #doctest

Ruby Doctest

Doctest in Python is a good design. Doctest ensures code, documentation, and tests are in a single place. So readers can understand the logic of code easier, without a lot of navigation.

Unlike Python, Ruby does not have built-in doctest, but there are some third party libraries enabling doctest in Ruby.

@lucasrcosta
lucasrcosta / awslambda.bootstrap.py
Last active October 26, 2021 12:06
AWS Lambda Python Runtime
# -*- coding: utf-8 -*-
# /var/runtime/awslambda/bootstrap.py
"""
aws_lambda.bootstrap.py
Amazon Lambda
Copyright (c) 2013 Amazon. All rights reserved.
Lambda runtime implemention
"""
@inadarei
inadarei / minikube-sierra.md
Last active October 20, 2020 01:57
Minikube Setup: Docker for Mac / Sierra

Prerequisite: latest Docker for Mac on MacOS Sierra

$ brew update
$ brew install --HEAD xhyve
$ brew install docker-machine-driver-xhyve
$ sudo chown root:wheel $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve
$ sudo chmod u+s $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve

$ curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.18.0/minikube-darwin-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/
@kingspp
kingspp / A Language Snippets
Last active November 3, 2023 16:35
Language Snippets #MySnippet
This gist reveals language snippets
@gene1wood
gene1wood / 01_get_account_id_for_user_ec2instance_role_or_lambda.py
Last active November 9, 2022 16:40
Method to determine your AWS account ID using boto3 for either a user or an ec2 instance or lambda function
import boto3
print(boto3.client('sts').get_caller_identity()['Account'])
@jmindek
jmindek / gist:62c50dd766556b7b16d6
Last active January 31, 2024 15:48
DISTINCT ON like functionality for Redshift

distinct column -> For each row returned, return only the unique members of a set. Think of it as for each row in a projection, concatenate all the column values and return only the strings that are unique.

test_db=# SELECT DISTINCT parent_id, child_id, id FROM test.foo_table ORDER BY parent_id, child_id, id LIMIT 10;
parent_id | child_id | id
-----------+------------+-----------------------------
1000040 | 103 | 1000040|2645405726|0001|103
@p-lewis
p-lewis / encode.js
Last active August 4, 2016 05:08
Encode a message in node.js for a Celery worker
var uuid = require("node-uuid");
// Create a message to be consumed by the queuedemo.tasks.add Celery task
// will incorporate arguments x & y as part of `add(x,y)` message
function makeCeleryAddMessage(x, y){
var msgId = uuid.v4();
// This is the outer AMQP envelope
var msgEnvelope = {
@tito
tito / README
Last active August 29, 2015 14:06
pyjnius / allow customization of the JNIENV function to get
P4A_pyjnius_DIR=~/code/pyjnius ./distribute.sh -b minimal -m 'pyjnius python' -u pyjnius
cd .; ./build.py --package org.minimal.test --name _MINIMAL --version 1 --private ~/code/testmininal --asset debug installd
adb logcat *:S python:D
@tito
tito / bluetooth.py
Created November 12, 2013 15:28
Bluetooth example on Android using Python / Pyjnius
'''
Bluetooth/Pyjnius example
=========================
This was used to send some bytes to an arduino via bluetooth.
The app must have BLUETOOTH and BLUETOOTH_ADMIN permissions (well, i didn't
tested without BLUETOOTH_ADMIN, maybe it works.)
Connect your device to your phone, via the bluetooth menu. After the
pairing is done, you'll be able to use it in the app.