sudo apt-get install libsdl2-dev
will install the SDL2 development library files. Headers will be in/usr/include/SDL2
.sudo apt-get install build-essential
to get compilers.- Install VSCode from market place.
- Install VSCode C++ extension.
- Set
"/usr/include"
and"/usr/include/SDL2"
inside theincludePath
array in VSCode either for current project or as default include path in settings. - Create main.cpp and put this insde:
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
#include "include/SFML/Audio.hpp" | |
#include "include/SFML/Graphics.hpp" | |
#include "include/box2d/box2d.h" | |
#include <iostream> | |
// g++ -std=c++11 sfml_grid.cpp -o sfml_grid -I include -L lib -l sfml-graphics -l sfml-window -l sfml-system -l sfml-audio -Wl,-rpath ./lib | |
int main(int, char const **) | |
{ | |
// Create the main window |
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 datetime | |
# Create utc datetime object. | |
utcdatetime = datetime.datetime.utcnow() | |
print(utcdatetime) | |
# Create unix epoch timestamp from datetime. | |
milliseconds = int(datetime.datetime.timestamp(utcdatetime) * 1000) | |
timestamp = datetime.datetime.timestamp(utcdatetime) | |
print(milliseconds) |
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 os | |
import matplotlib.pyplot as plt | |
import numpy as np | |
my_path = os.path.dirname(os.path.abspath(__file__)) | |
timestamps = [1625086800000, | |
1625173200000, | |
1625259600000, | |
1625346000000, |
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
useEffect(() => { | |
let isMounted = true; // Used to make sure we don't make state update after component dismount. | |
const socket = io('ws://localhost:5000/live'); | |
socket.on('connect', function () { | |
console.log('CONNECTED'); | |
}); | |
socket.on('disconnect', function () { | |
console.log('DISCONNECTED'); | |
}); | |
socket.on('update', function (payload: any) { |
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
def square_numbers(nums): | |
for i in nums: | |
yield(i*i) | |
mynums = square_numbers([1,2,3]) | |
for num in mynums: | |
print(num) | |
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 React, { useState } from 'react'; | |
import FeatureHeading from '../components/FeatureHeading'; | |
import { io } from 'socket.io-client'; | |
import { useEffect } from 'react'; | |
export default function LiveFeedView() { | |
/** Create socket conenction. */ | |
const [live, setLive] = useState(null); |
- Download development library from https://www.libsdl.org/download-2.0.php
- From extracted
SDL2/i686-w64-mingw32/include
folder, copy the SDL2 folder to your project/include (so that inside your project you will have include/SDL2). - From
SDL2/i686-w64-mingw32/bin
folder, copy SDL2.dll to your project root. - From
SDL2/i686-w64-mingw32/lib
folder, copy libSDL2main.a to your project root.
In your project root, create main.cpp with this code:
- Download SFML for Mac from: https://www.sfml-dev.org/download.php
- From extracted folder, copy contents of
Frameworks
andextlibs
folders to/Library/Frameworks
. - From extracted folder, copy
templates
folder to~/Library/Developer/Xcode/Templates
. - Create new project with SFML template and select using of Frameworks instead of dynamic libraries.
- If building fails, go to
Build phases
and select For install builds only.
sudo apt install python3-pip --fix-missing
pip3 install virtualenv
nano ~/.profile
and add the location to path, copy paste this kind of line in the end of the file:PATH="$PATH:/home/mikal/.local/bin"
or wherever it is located. After installation, virtualenv lets you know the location.- Now you can create virtual environment using
virtualenv venv
- Activate your environment using
source venv/bin/activate
and you will see (venv) appearing in front of your command prompt.