Skip to content

Instantly share code, notes, and snippets.

@half2me
half2me / BaseCardlet.java
Created May 13, 2018 17:20
FidesmoCrypto
package com.fidesmo.javacard.example;
import javacard.framework.*;
import javacard.security.*;
public abstract class BaseCardlet extends Applet implements ISO7816 {
KeyPair kp;
Signature sig;
BaseCardlet(byte[] buffer, short offset, byte length) {
package com.company;
//import org.bouncycastle.jce.ECPointUtil;
import javax.smartcardio.CardChannel;
import javax.smartcardio.CardException;
import javax.smartcardio.CommandAPDU;
import javax.smartcardio.ResponseAPDU;
import java.math.BigInteger;
import java.nio.ByteBuffer;
@half2me
half2me / test.sh
Created March 29, 2018 13:50
Baytrail Vaapi matroska
gst-launch-1.0 videotestsrc ! vaapih264enc ! matroskamux ! fakesink
# Gstreamer 14.0 on Baytrail
Setting pipeline to PAUSED ...
error: XDG_RUNTIME_DIR not set in the environment.
Pipeline is PREROLLING ...
Got context from element 'vaapiencodeh264-0': gst.vaapi.Display=context, gst.vaapi.Display=(GstVaapiDisplay)"\(GstVaapiDisplayDRM\)\ vaapidisplaydrm1";
ERROR: from element /GstPipeline:pipeline0/GstVideoTestSrc:videotestsrc0: Internal data stream error.
Additional debug info:
../libs/gst/base/gstbasesrc.c(3055): gst_base_src_loop (): /GstPipeline:pipeline0/GstVideoTestSrc:videotestsrc0:
@half2me
half2me / ExampleCardlet.java
Last active March 26, 2018 13:22
Javacard PKI
package com.fidesmo.javacard.example;
import javacard.framework.*;
import javacard.security.*;
public class ExampleCardlet extends Applet
{
private static final short MAX_LENGTH = 256;
private static final byte[] hello = {'p','k','i','t','c','h'};
@half2me
half2me / GstFtpSink.py
Created August 8, 2017 13:54
Example FTP Sink for Gstreamer1.0 in Python3
#
# Make sure you have py-gst installed (on OSX: brew install py-gst)
# export GST_PLUGIN_PATH=$GST_PLUGIN_PATH:$PWD/ # this will be the folder containing the "python" directory
# You must put this script in a directory called "python" for this to work :)
#
# Example usage:
# GST_DEBUG=python:4 gst-launch-1.0 videotestsrc ! jpegenc ! ftpsink
import ftplib
import io
@half2me
half2me / grafika.cpp
Created November 25, 2016 19:22
OpenGL Camera rotation problem
class Camera {
public:
vec4 eye; // Specifies the position of the eye point.
vec4 center; // Specifies the position of the reference point.
vec4 up; // For tilting the camera
float fov; // Field of view
float near, far; // Near and far clipping plane
Camera() {
eye = vec4(0, 0, 2);
center = vec4();
@half2me
half2me / CMakeLists.txt
Created October 23, 2016 11:19
Mac Cmake file for graphics
cmake_minimum_required(VERSION 3.6)
project(grafika)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(SOURCE_FILES main.cpp)
find_package(OpenGL REQUIRED)
find_package(GLUT REQUIRED)
include_directories(${OPENGL_INCLUDE_DIRS} ${GLUT_INCLUDE_DIRS})
Első feladat
Fekete háttér előtt a gömb alakú, 0.2 1/sec fordulatszámmal forgó, 40 ezer km kerületű földet látjuk a képernyőn, amelynek sziluettjét fehérrel, 30 fokonként a hosszúsági és szélességi köreit szürkével rajzoljuk fel. A virtuális kameránk merőleges vetítést használ, a megjelenítés huzalváz jellegű. A földgömb kép 90%-át foglalja el függőleges irányban, a földgömb közepe a kép közepén van. Egérrel a bal gombbal ráklikkelve a föld elülső felületére repülőgépeket indíthatunk és azok útvonalát jelölhetjük ki egészen addig, amíg a jobb gombbal a célállomást megadjuk. A kiindulási reptér, közbenső pontok és a célreptér között a repülő a legrövidebb úton halad 10 km magasságban, állandó körív menti (Rodriguez vagy SLERP) 5 ezer km/sec sebességgel (most ne foglalkozzunk a szökési sebességgel). A repülő az orrát követi, a szárnyai pedig a gravitáció irányára merőlegesek. A repülési pályát piros vonal mutatja. A repülőt Catmull-Rom spline-nal definiált zöld színű kitöltött konkáv területtel jelenítjük meg,
@half2me
half2me / gitupdate.sh
Last active September 26, 2016 09:46
gitupdate.sh
#!/bin/bash
startDir=$(pwd)
echo "Updating ANT+ driver..."
cd /home/pi/libant/
git reset --hard HEAD
git pull
sudo python3 setup.py install
echo "Done!"
@half2me
half2me / test.sh
Created September 22, 2016 12:58
test.sh
#!/bin/sh
echo "Hello World"