This file contains hidden or 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 net.mbedtls | |
const x = mbedtls.is_used // just silence a V warning, since we are using only the C functions from net.mbedtls, but not any pub V fn etc | |
type FnRNG = fn(p_rng voidptr, output &u8, output_len usize) int | |
fn C.mbedtls_pk_parse_public_keyfile(pk &C.mbedtls_pk_context, path &u8) int | |
fn C.mbedtls_pk_encrypt(pk &C.mbedtls_pk_context, const_input &u8, ilen usize, output &u8, olen &usize, osize usize, f_rng FnRNG, p_rng voidptr) int | |
fn C.mbedtls_pk_decrypt(pk &C.mbedtls_pk_context, const_input &u8, ilen usize, output &u8, olen &usize, osize usize, f_rng FnRNG, p_rng voidptr) int |
This file contains hidden or 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
// I have a special case where i need to create and give a c++ class with virtual methods, | |
// so i came up with this proof of concept. | |
// Known limitation: | |
// - accesing class member/methods from "this" is pertty impossible without storing the Cxx struct globaly | |
// - you can't pass struct methods since the struct ptr will overwrite the real "this" ptr | |
// use it: | |
// v -enable-globals -shared vxx.v (work well with autofree and prod) | |
// g++ vxx_class.cc |
This file contains hidden or 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 | |
fn C.execvp(file charptr, argv &charptr) int | |
fn main() { | |
final_editor_cmd := os.file_name(os.args[0])[1..] | |
if os.args.len < 2 { | |
eprintln('Usage: `v$final_editor_cmd FILE:LINE: ...`') | |
exit(1) | |
} |
This file contains hidden or 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 | |
os.system('stty -icanon') | |
os.system('stty -echo') | |
println('\x1b[?1003h\x1b[?1015h\x1b[?1006h') | |
for signal in 0 .. 64 { | |
os.signal(signal, fn() { | |
os.system('stty icanon') | |
os.system('stty echo') |
This file contains hidden or 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
[gd_scene load_steps=3 format=2] | |
[sub_resource type="Shader" id=1] | |
code = "shader_type canvas_item; | |
// Godot Nvidia FXAA 3.11 Port | |
// Usage: Drop this in to any 3D scene for FXAA! This is a port of the \"PC High Quality Preset 39\". However the medium quality | |
// parameters are also included. For medium quality, just comment out sections \"PS 6\" and above and uncomment the \"med 13\" variables. |
This file contains hidden or 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
package org.veiset.tsar.world | |
import com.badlogic.gdx.math.Vector2 | |
import org.veiset.tsar.engine2.utils.component1 | |
import org.veiset.tsar.engine2.utils.component2 | |
import org.veiset.tsar.engine2.utils.x | |
import org.veiset.tsar.world.icon.WorldIcon | |
import kotlin.math.absoluteValue | |
import kotlin.math.cos | |
import kotlin.math.pow |
This file contains hidden or 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 QtQuick 2.9 | |
Binding { | |
id: root | |
property int delay: 500 | |
property alias value: root._delayedValue | |
property alias _actualValue: root.value | |
property var _delayedValue |
This file contains hidden or 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
/******************************************************************************/ | |
// SIMPLE INPUT RECORD/PLAYBACK | |
// (c) 2015 Brian Provinciano | |
// | |
// You are free to use this code for your own purposes, no strings attached. | |
// | |
// This is a very basic sample to record and playback button input. | |
// It's most useful when activated on startup, deactivated on shutdown for | |
// global button recording/playback. | |
// |
This file contains hidden or 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
// adapted from http://pythonwise.blogspot.in/2009/06/strftime-for-javascript.html | |
/* | |
To use it , save this gist in a file , import it into the desired QML | |
call as: | |
DateUtils.strftime ( format , dateObj); |
NewerOlder