This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__kernel void hello(__global char* string) | |
{ | |
string[0] = 'H'; | |
string[1] = 'e'; | |
string[2] = 'l'; | |
string[3] = 'l'; | |
string[4] = 'o'; | |
string[5] = ','; | |
string[6] = ' '; | |
string[7] = 'W'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const RECEIVE_PORT = 3001; | |
const SEND_PORT = 3002; | |
const dgram = require('dgram'); | |
const server = dgram.createSocket('udp4'); | |
server.on('listening', function () { | |
let address = server.address(); | |
console.log(`UDP server listening on ${address.address}:${address.port}`); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** from: https://nodejs.org/api/net.html#net_server_address */ | |
const net = require('net'); | |
const util = require('util'); | |
const port = 3000; | |
let server = net.createServer((socket) => { | |
//give it an id | |
socket.id = Math.floor(Math.random() * 1000); | |
//console.log(util.inspect(socket)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** from: https://nodejs.org/api/net.html#net_net_createconnection_options_connectlistener */ | |
const net = require('net'); | |
const port = 3000; | |
const client = net.createConnection({ port: 3000 }, () => { | |
console.log('connected to server!'); | |
//pipe immediately something back | |
client.write('Hello from TCP client!\r\n'); | |
//send delayed data test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from aiohttp import web | |
import socketio | |
from colorama import init, Fore | |
init(autoreset=True) | |
sio = socketio.AsyncServer() | |
app = web.Application() | |
sio.attach(app) | |
async def index(request): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
def download_file_from_google_drive(id, destination): | |
def get_confirm_token(response): | |
for key, value in response.cookies.items(): | |
if key.startswith('download_warning'): | |
return value | |
return None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let from = 80; | |
let to = 8080; | |
const httpProxy = require('http-proxy'); | |
if(process.argv.length != 4){ | |
console.log('Did not supply from/to params, remapping ' + from + ' to ' + to); | |
} | |
else{ | |
from = Number(process.argv[2]); | |
to = Number(process.argv[3]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//assuming you're using https://www.npmjs.com/package/mysql | |
const mysql = require('mysql'); | |
const con = mysql.createConnection({ | |
host: "localhost", | |
user: "yourusername", | |
password: "yourpassword", | |
database: "mydb" | |
}); | |
socket.on('sqlQuery', function(queryData, callback){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express') | |
const app = express() | |
app.use(express.json()) | |
app.post( | |
'/', | |
(req, res) => { | |
console.log(req.body); | |
let resObj = { replyType:"echo", content: req.body}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Delta Compression by Glenn Fiedler. | |
This source code is placed in the public domain. | |
http://gafferongames.com/2015/03/14/the-networked-physics-data-compression-challenge/ | |
*/ | |
#include <stdint.h> | |
#include <stdio.h> | |
#include <assert.h> | |
#include <string.h> |