Skip to content

Instantly share code, notes, and snippets.

View microchipgnu's full-sized avatar
🖼️
µ

Luís Freitas microchipgnu

🖼️
µ
View GitHub Profile
var express = require('express');
var http = require('http')
var socketio = require('socket.io');
var app = express();
var server = http.Server(app);
var websocket = socketio(server);
server.listen(3000, () => console.log('listening on *:3000'));
// The event will be called when a client is connected.
<!DOCTYPE html>
<html>
<head>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<title>API request</title>
</head>
<body>
<h1>Open the console to see it working.</h1>
<script>
const Tx = require('ethereumjs-tx')
const Web3 = require('web3')
const program = require('commander')
const fs = require('fs')
const path = require('path')
const {
Client, NonceTxMiddleware, SignedTxMiddleware, Address, LocalAddress, CryptoUtils, LoomProvider,
Contracts, Web3Signer, soliditySha3
} = require('loom-js')
// TODO: fix this export in loom-js
protocolo nome
1 Centro Doutor João dos Santos - Casa da Praia (IPSS)
3 Centro de Psicologia e Desenvolvimento de Almada
4 Centro Social e Cultural Nossa Senhora do Ó de Aguim
5 Cooperativa para a Educação e Reabilitação de Cidadãos Inadaptados de Cascais (CERCICA)
7 Discursos e Práticas, Recursos Humanos, Lda.
8 FACTOR SOCIAL
11 LógicaMentes - Centro de Desenvolvimento Infantil
15 NUPIC - Núcleo de Psicologia e Intervenção Comunitária (Carnide/ Lisboa)
17 Vicentina - Associação para o Desenvolvimento do Sudoeste
{"_id":"5c9cebfc60533077a01e26a7","structuredData":[{"coordinates":{"latitude":-9.095019,"longitude":38.761218},"id":"emel_gira_stations.242","id_expl":"001","name":"103-Jardim da Ã�gua","num_bicycles":2,"num_docks":20,"ratio":0.1,"state":"active","update_date":"2018-08-06T07:40:13Z","collected_at":1553787900177},{"coordinates":{"latitude":-9.096222,"longitude":38.768548},"id":"emel_gira_stations.158","id_expl":"105","name":"105 - CC Vasco da Gama","num_bicycles":17,"num_docks":40,"ratio":0.43,"state":"active","update_date":"2019-03-28T15:40:05Z","collected_at":1553787900177},{"coordinates":{"latitude":-9.095019,"longitude":38.761218},"id":"emel_gira_stations.161","id_expl":"103","name":"103 - Jardim da Água","num_bicycles":20,"num_docks":20,"ratio":1,"state":"active","update_date":"2019-03-28T15:40:06Z","collected_at":1553787900177},{"coordinates":{"latitude":-9.09235,"longitude":38.774289},"id":"emel_gira_stations.164","id_expl":"108","name":"108 - Rua do Bojador","num_bicycles":10,"num_docks":14,"ratio":0.
@microchipgnu
microchipgnu / install_pstree.md
Last active April 11, 2019 10:10
pstree: pstree is a small, command line (i.e., all-text mode) program that displays the processes (i.e., executing instances of programs) on the system in the form of a tree diagram. It differs from the much more commonly used (and more complex) ps program in a number of respects, including that the latter shows the processes in a list rather th…

Linux pstree shows running processes as a tree. The tree is rooted at either pid or init if pid is omitted. If a user name is specified, all process trees rooted at processes owned by that user are shown. Install pstree

On Mac OS

brew install pstree

On Fedora/Red Hat/CentOS

 
## On Ubuntu/Debian APT
@microchipgnu
microchipgnu / check_processes_gcloud.sh
Created April 11, 2019 10:09
List processes for given name and show tree list for all processes. Install pstree (as seen in other gist I have).
PROCESS_NAME=$1
echo "Showing list for" $1 "\n"
ps -aux | less | grep $1
echo "Showing tree list \n"
pstree
@microchipgnu
microchipgnu / reduce-example.js
Created April 23, 2019 14:58
Reduce example
const fruitBasket = ['banana', 'cherry', 'orange', 'apple', 'cherry', 'orange', 'apple', 'banana', 'cherry', 'orange', 'fig' ];
const count = fruitBasket.reduce( (tally, fruit) => {
tally[fruit] = (tally[fruit] || 0) + 1 ;
return tally;
} , {})
count // { banana: 2, cherry: 3, orange: 3, apple: 2, fig: 1 }

List all simulators created

  • xcrun simctl list --json

Get rid of all unused simlators

  • xcrun simctl delete unavailable

Select device and start Simulator

  • xcrun simctl boot <uuid>
  • open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app/

Oculus Go VLC screencast

Windows over USB

adb exec-out "while true; do screenrecord --bit-rate=8m --output-format=h264 --time-limit 180 -; done" | "C:\Program Files\VideoLAN\VLC\vlc.exe" --demux h264 --h264-fps=60 --clock-jitter=0 --network-caching=100 --sout-mux-caching=100 -

For more information, visit this site.