Skip to content

Instantly share code, notes, and snippets.

View flunardelli's full-sized avatar

Fernando Lunardelli flunardelli

View GitHub Profile
"""
clients array:
0 - Socket
1 - nickname
2 - active client or not (0 active , -1 disconnected)
3 - client ip
"""
from socket import * # sockets
from threading import Thread # thread
@flunardelli
flunardelli / sendPush.txt
Created July 12, 2018 18:36 — forked from valfer/sendPush.txt
Sending Push Notification with HTTP2 (and PHP) see entire post at: http://coding.tabasoft.it/ios/sending-push-notification-with-http2-and-php/
<?php
/**
* @param $http2ch the curl connection
* @param $http2_server the Apple server url
* @param $apple_cert the path to the certificate
* @param $app_bundle_id the app bundle id
* @param $message the payload to send (JSON)
* @param $token the token of the device
* @return mixed the status code (see https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/APNsProviderAPI.html#//apple_ref/doc/uid/TP40008194-CH101-SW18)
using UnityEngine;
using System.Collections;
public class ExampleClass : MonoBehaviour {
public Rigidbody projectile;
void Update() {
if (Input.GetButtonDown("Fire1")) {
Rigidbody clone;
clone = Instantiate(projectile, transform.position, transform.rotation) as Rigidbody;
clone.velocity = transform.TransformDirection(Vector3.forward * 10);
@flunardelli
flunardelli / .htaccess
Created June 3, 2017 00:08 — forked from revolunet/.htaccess
global enable CORS without touching code
# with AJAX withCredentials=false (cookies NOT sent)
Header always set Access-Control-Allow-Origin "*"
Header always set Access-Control-Allow-Methods "POST, GET, PUT, OPTIONS, PATCH, DELETE"
Header always set Access-Control-Allow-Headers "X-Accept-Charset,X-Accept,Content-Type"
RewriteEngine On
RewriteCond %{REQUEST_METHOD} OPTIONS
RewriteRule ^(.*)$ $1 [R=200,L,E=HTTP_ORIGIN:%{HTTP:ORIGIN}]]
# with AJAX withCredentials=true (cookies sent, SSL allowed...)
SetEnvIfNoCase ORIGIN (.*) ORIGIN=$1
<link rel="import" href="../chart-js/chart-js.html">
<link rel="import" href="../speech-mic/speech-mic.html">
<link rel="import" href="../topeka-elements/category-icons.html">
<link rel="import" href="../core-icon/core-icon.html">
<polymer-element name="my-element">
<template>
<style>
:host {
@flunardelli
flunardelli / elasticsearch-config.txt
Last active August 29, 2015 14:01
Elasticseach config
ulimit -l unlimited
/etc/sysctl.conf
vm.swappiness = 0
/etc/sysconfig/elasticsearch
ES_HEAP_SIZE=1024m
ES_JAVA_OPTS="-server”
MAX_LOCKED_MEMORY=unlimited
@flunardelli
flunardelli / app.js
Created May 24, 2011 12:27
Aplicação padrão Titanium com algumas modificações e comentários
//Define a cor padrão para o fundo da aplicação
Titanium.UI.setBackgroundColor('#000');
// cria um grupo de tabs
var tabGroup = Titanium.UI.createTabGroup();
//
// cria a janela principal da primeira Tab
//