Skip to content

Instantly share code, notes, and snippets.

View elect86's full-sized avatar
🏠
Working from home

Giuseppe Barbieri elect86

🏠
Working from home
View GitHub Profile
@NitinPraksash9911
NitinPraksash9911 / UnzipUtils.kt
Last active May 6, 2024 15:31
Unzipping file in android/kotlin
import java.io.*
import java.util.zip.ZipFile
/**
* UnzipUtils class extracts files and sub-directories of a standard zip file to
* a destination directory.
*
*/
object UnzipUtils {
even_letters = "bcdfghlmnprstwx"
odd_letters = "aeiou"
def format_uid_digit (n, level):
if n != 0:
letters = odd_letters if (level & 1) else even_letters
base = len(letters)
s = format_uid_digit(n / base, level + 1)
return s + letters[(n % base)]
return ""
@domnikl
domnikl / build.gradle.kts
Last active April 12, 2024 22:34
Gradle Kotlin DSL: set main class attribute for jar
tasks.withType<Jar> {
manifest {
attributes["Main-Class"] = "com.example.MainKt"
}
}
@jeremyselan
jeremyselan / example.cpp
Created October 24, 2016 23:33
OpenVR GetStringTrackedDeviceProperty Wrapper
std::string GetStringTrackedDeviceProperty( vr::IVRSystem * pSystem, vr::TrackedDeviceIndex_t unDeviceIndex, vr::ETrackedDeviceProperty prop, vr::ETrackedPropertyError *pError )
{
vr::ETrackedPropertyError err = TrackedProp_Success;
std::string sRetVal;
char buf[32];
uint32_t unPropLen = pSystem->GetStringTrackedDeviceProperty( unDeviceIndex, prop, buf, sizeof( buf ), &err );
if ( err == vr::TrackedProp_Success )
{
@aborruso
aborruso / updatefile.sh
Last active May 3, 2024 09:44
How to update a file in github via cURL
#!/bin/bash
cartella="/var/myfolder"
# update the file
curl -i -X PUT -H 'Authorization: token 4d013330xxxxxxxxxxxxxx' -d "{\"path\": \"mattei.csv\", \
\"message\": \"update\", \"content\": \"$(openssl base64 -A -in $cartella/mattei.csv)\", \"branch\": \"master\",\
\"sha\": $(curl -X GET https://api.github.com/repos/username/repo/contents/mattei.csv | jq .sha)}" \
https://api.github.com/repos/username/repo/contents/mattei.csv
@liam-middlebrook
liam-middlebrook / GLDebugMessageCallback.c
Last active March 26, 2024 13:06
GL Debug Output Message Callback Guide
// This is free and unencumbered software released into the public domain.
//
// Anyone is free to copy, modify, publish, use, compile, sell, or distribute
// this software, either in source code form or as a compiled binary, for any
// purpose, commercial or non-commercial, and by any means.
//
// In jurisdictions that recognize copyright laws, the author or authors of this
// software dedicate any and all copyright interest in the software to the
// public domain. We make this dedication for the benefit of the public at large
// and to the detriment of our heirs and successors. We intend this dedication