Skip to content

Instantly share code, notes, and snippets.

View d0p3t's full-sized avatar
❤️
be nice

Remco d0p3t

❤️
be nice
View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@d0p3t
d0p3t / listfirst.js
Created August 20, 2017 19:07
For dannytoke
var myArray = ['Bobby', 'Jack', 'Danny'];
var favCities = ['Atlanta', 'Miami'];
function listFirst(array) {
return array[0];
}
console.log(listFirst(myArray));
console.log(listFirst(favCities));
var tmi = require('tmi.js');
var config = require('./config.js');
var client = new tmi.client(config.tmi);
client.connect();
client.on("subscription", function (channel, username, method, message, userstate) {
if (method.prime === true) {
console.log("Prime Sub");
const tmi = require('tmi.js');
const discord = require('discord.js');
const config = require('./config/config.js'); // see https://github.com/d0p3t/d0p3tbot/blob/master/config/config_sample.js for an example
// Initialize tmi twitch bot and connect
const client = new tmi.client(config.tmi);
client.connect();
// Initialize discord bot and connect
const discordClient = new Discord.Client();
var tmi = require('tmi.js')
var options = {
options: {
debug: true
},
connection: {
reconnect: true
},
identity: {
RegisterServerEvent('vRP:payment')
RegisterServerEvent('vRP:salary')
AddEventHandler('vRP:payment',function(player, amount)
local user_id = vRP.getUserId(player)
if user_id ~= nil then
vRP.giveMoney(user_id, amount)
end
end)
var anchors = {}
anchors["minimap"] = [];
anchors["center"] = [];
anchors["botright"] = [];
function ProgressBar(data)
{
this.data = data;
this.value = data.value;
this.disp_value = data.value;
@d0p3t
d0p3t / test.py
Created April 9, 2017 01:29
Video capture using OpenCV if you wanna try it. Works on my mac
import numpy as np
import cv2
from PIL import ImageGrab
fourcc = cv2.cv.CV_FOURCC(*'XVID') # or cv2.VideoWriter_fourcc('X','V','I','D') if you use opencv 3.0
vid = cv2.VideoWriter('record.avi', fourcc, 8, (500,490))
while(True):
img = ImageGrab.grab(bbox=(100, 10, 600, 500)) #x, y, w, h
img_np = np.array(img)
#frame = cv2.cvtColor(img_np, cv2.COLOR_BGR2GRAY)