Skip to content

Instantly share code, notes, and snippets.

View paulonteri's full-sized avatar
💻
Building

Paul Onteri paulonteri

💻
Building
View GitHub Profile
import signal
import sys
import asyncio
import aiohttp
import json
loop = asyncio.get_event_loop()
client = aiohttp.ClientSession(loop=loop)
async def get_json(client, url):
@paulonteri
paulonteri / sampleREADME.md
Created September 15, 2020 14:33 — forked from FrancesCoronel/sampleREADME.md
A sample README for all your GitHub projects.

FVCproductions

INSERT GRAPHIC HERE (include hyperlink in image)

Repository Title Goes Here

Subtitle or Short Description Goes Here

@paulonteri
paulonteri / saphyra.py
Created October 7, 2020 14:33
Saphyra - DDoS Tool
# ----------------------------------------------------------------------------------------------
# Saphyra - DDoS Tool
#
# The DDoS Protocol is the most massive type of attack
# This tool can tangodown nasa and more gov websites
#
#
# author : Anonymous , version 1.0
# ----------------------------------------------------------------------------------------------
import urllib2
@paulonteri
paulonteri / postmanGetAuthToken.js
Last active October 24, 2020 07:49
Get auth token from postman
pm.test("Status code is 200", function () {
pm.response.to.have.status(200);
});
// check whether the request hast the Auth Token (auth_token)
var token;
pm.test("Body has auth_token", function () {
pm.expect(pm.response.text()).to.include("auth_token");
token = pm.response.json().auth_token
});
@paulonteri
paulonteri / passParamsDeeplyNestedNavigators.js
Created October 27, 2020 06:16
Pass params to deeply nested navigators - React Native
props.navigation.navigate('ProjectManagement', {
screen: 'Stages',
params: {
screen: 'AllStagesList',
params: { projectId: props.projectDetail.id },
},
});
@paulonteri
paulonteri / useEffectAsnc.jsx
Created October 31, 2020 08:49
Async useEffect
useEffect(() => {
(async () => {
if (Platform.OS !== "web") {
const {
status,
} = await ImagePicker.requestCameraRollPermissionsAsync();
if (status !== "granted") {
alert("Sorry, we need camera roll permissions to make this work!");
}
}
@paulonteri
paulonteri / addToCartRNAsyncStorage.js
Created October 31, 2020 21:00
React Native (AsyncStorage) Add to Cart Functions
// @flow
// with flow types -> https://flow.org
import AsyncStorage from '@react-native-async-storage/async-storage';
// common types
type CartItem = { itemId: number, quantity: number };
type Cart = Array<CartItem>;
const CART: string = 'QUOTE_LIST';
@paulonteri
paulonteri / filterArray.js
Created February 8, 2021 02:39 — forked from jherax/arrayFilterFactory.1.ts
Filters an array of objects with multiple match-criteria.
/**
* Filters an array of objects using custom predicates.
*
* @param {Array} array: the array to filter
* @param {Object} filters: an object with the filter criteria
* @return {Array}
*/
function filterArray(array, filters) {
const filterKeys = Object.keys(filters);
return array.filter(item => {
@paulonteri
paulonteri / num_files.py
Created February 8, 2021 05:59
number of files in directory and subdirectory
total = 0
for root, dirs, files in os.walk("."):
total += len(files)
print(total)
@paulonteri
paulonteri / 00.install-android-sdk.sh
Last active February 11, 2021 17:20 — forked from nhtua/00.install-android-sdk.sh
Run a Headless Android Device on Ubuntu server (no GUI)
#!/bin/bash -i
#using shebang with -i to enable interactive mode (auto load .bashrc)
set -e #stop immediately if any error happens
# Install Open SDK
apt update
apt install openjdk-8-jdk -y
update-java-alternatives --set java-1.8.0-openjdk-amd64
java -version