Skip to content

Instantly share code, notes, and snippets.

@cgvarela
cgvarela / tegra-cam.py
Created November 15, 2019 13:13 — forked from jkjung-avt/tegra-cam.py
Capture and display video from either IP CAM, USB webcam, or the Tegra X2/X1 onboard camera.
# --------------------------------------------------------
# Camera sample code for Tegra X2/X1
#
# This program could capture and display video from
# IP CAM, USB webcam, or the Tegra onboard camera.
# Refer to the following blog post for how to set up
# and run the code:
# https://jkjung-avt.github.io/tx2-camera-with-python/
#
# Written by JK Jung <[email protected]>
@cgvarela
cgvarela / Conda.md
Created July 22, 2019 09:39 — forked from misho-kr/Conda.md
Summary of "Conda Essentials" course at DataCamp.Com

Summary

Conda packages are files containing a bundle of resources: usually libraries and executables, but not always. In principle, Conda packages can include data, images, notebooks, or other assets.

One of the powerful aspects of conda, both the tool and the package format, is that dependencies are taken care of. That is, when you install any Conda package, any other packages needed get installed automatically.

A Conda package, then, is a file containing all files needed to make a given program execute correctly on a given system.

@cgvarela
cgvarela / tweet_listener.py
Created June 14, 2019 11:43 — forked from hugobowne/tweet_listener.py
Here I define a Tweet listener that creates a file called 'tweets.txt', collects streaming tweets as .jsons and writes them to the file 'tweets.txt'; once 100 tweets have been streamed, the listener closes the file and stops listening.
class MyStreamListener(tweepy.StreamListener):
def __init__(self, api=None):
super(MyStreamListener, self).__init__()
self.num_tweets = 0
self.file = open("tweets.txt", "w")
def on_status(self, status):
tweet = status._json
self.file.write( json.dumps(tweet) + '\n' )
self.num_tweets += 1
@cgvarela
cgvarela / alexa_skill_example.php
Created January 11, 2019 11:05 — forked from solariz/alexa_skill_example.php
Amazon Echo / Alexa Intent example in PHP with Security validation
<?php
/* This is a simple PHP example to host your own Amazon Alexa Skill written in PHP.
In my Case it connects to my smarthome Raspberry pi Cat Feeder with two intents;
1: Dispense Food to the cats.
2: When did the Feeder last time feed the cats? Return a spoken time / date
This Script contains neccessary calls and security to give you a easy to use DIY example.
v2016.12.29
Details in my Blogpost: https://solariz.de/de/amazon-echo-alexa-meets-catfeeder.htm
*/
@cgvarela
cgvarela / main.go
Created May 28, 2018 09:32 — forked from julz/main.go
containersched minicontainer
package main
import (
"fmt"
"os"
"os/exec"
"syscall"
)
func main() {
@cgvarela
cgvarela / nginx.conf
Created March 2, 2017 05:57 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@cgvarela
cgvarela / batman.m
Created January 26, 2017 09:57 — forked from traeblain/batman.m
Batman Equation
clf; clear; syms x y
eq1 = ((x/7)^2*sqrt(abs(abs(x)-3)/(abs(x)-3))+(y/3)^2*sqrt(abs(y+3/7*sqrt(33))/(y+3/7*sqrt(33)))-1);
eq2 = (abs(x/2)-((3*sqrt(33)-7)/112)*x^2-3+sqrt(1-(abs(abs(x)-2)-1)^2)-y);
eq3 = (9*sqrt(abs((abs(x)-1)*(abs(x)-.75))/((1-abs(x))*(abs(x)-.75)))-8*abs(x)-y);
eq4 = (3*abs(x)+.75*sqrt(abs((abs(x)-.75)*(abs(x)-.5))/((.75-abs(x))*(abs(x)-.5)))-y);
eq5 = (2.25*sqrt(abs((x-.5)*(x+.5))/((.5-x)*(.5+x)))-y);
eq6 = (6*sqrt(10)/7+(1.5-.5*abs(x))*sqrt(abs(abs(x)-1)/(abs(x)-1))-(6*sqrt(10)/14)*sqrt(4-(abs(x)-1)^2)-y);
eqf = '((x/7)^2*sqrt(abs(abs(x)-3)/(abs(x)-3))+(y/3)^2*sqrt(abs(y+(3*sqrt(33))/7)/(y+(3*sqrt(33))/7))-1)*(abs(x/2)-((3*sqrt(33)-7)/112)*x^2-3+sqrt(1-(abs(abs(x)-2)-1)^2)-y)*(9*sqrt(abs((abs(x)-1)*(abs(x)-3/4))/((1-abs(x))*(abs(x)-3/4)))-8*abs(x)-y)*(3*abs(x)+3/4*sqrt(abs((abs(x)-3/4)*(abs(x)-1/2))/((3/4-abs(x))*(abs(x)-1/2)))-y)*(9/4*sqrt(abs((x-1/2)*(x + 1/2))/((1/2-x)*(1/2+x)))-y)*((6*sqrt(10))/7+(3/2-abs(x)/2)*sqrt(abs(abs(x)-1)/(abs(x)-1))-(6*sqrt(10))/14*sqrt(4-(abs(x)-1)^2)-y)=0'
#!/bin/bash
mkfs.ext4 /dev/sdb
mkfs.ext4 /dev/sdc
mkdir /data
mkdir /data/data{1,2}
mount /dev/sdb /data/data1
mount /dev/sdc /data/data2
@cgvarela
cgvarela / queries.sql
Created December 15, 2015 10:14 — forked from jodok/queries.sql
-- Techcrunch Demo Queries
-- count all steps records
SELECT count(*) FROM steps;
-- count all steps
SELECT sum(num_steps) FROM steps;
-- count all steps for a specific user
SELECT sum(num_steps) AS steps_for_user FROM steps WHERE username = 'gosinski';
@cgvarela
cgvarela / gist:dea08dc47f638c9195d2
Created December 15, 2015 10:12 — forked from jodok/gist:38aaaf5826211d5eef8b
amsterdam benchmark
import sys
import time
import random
from crate.client import connect
from threading import Thread
from Queue import Queue
from uuid import uuid1
host = sys.argv[1]