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
fn main() -> Result<(), rusqlite::Error> { | |
let db = Connection::open_in_memory()?; | |
let module = rusqlite::vtab::eponymous_only_module::<Test>(); | |
db.create_module::<Test>("test", module, None)?; | |
// normal rusqlite code from here on out... | |
println!("Hello, world!"); | |
let mut s = db.prepare("SELECT * FROM test WHERE id=1")?; |
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
#[allow(clippy::not_unsafe_ptr_arg_deref)] | |
#[no_mangle] | |
pub extern "C" fn sqlite3_extension_init( | |
db: *mut ffi::sqlite3, | |
pz_err_msg: *mut *mut c_char, | |
p_api: *mut ffi::sqlite3_api_routines, | |
) -> c_int { | |
if p_api.is_null() { | |
return ffi::SQLITE_ERROR; | |
} else if let Err(err) = extension_init(db, p_api) { // we handoff to `extenstion_init` |
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
use std::{ffi::c_int, marker::PhantomData}; | |
use rusqlite::ffi; | |
use rusqlite::{ffi::{sqlite3_vtab, sqlite3_vtab_cursor}, vtab::{Context, IndexInfo, VTab, VTabConnection, VTabCursor, Values}, Connection}; | |
use std::os::raw::c_char; | |
use rusqlite::{to_sqlite_error, Result}; | |
#[repr(C)] | |
struct Test { | |
/// Base class. Must be first |
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
{ | |
$schema: https://vega.github.io/schema/vega/v3.0.json | |
data: [ | |
{ | |
// query ES based on the currently selected time range and filter string | |
name: rawData | |
url: { | |
%context%: true | |
%timefield%: @timestamp | |
index: winlogbeat-* |
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
fn bytes_to_sid(binary :&Vec<u8>) -> String { | |
let version = binary[0]; | |
let length = binary[1] as usize; | |
let authority = u64::from_be_bytes([0, 0, binary[2], binary[3], binary[4], binary[5], binary[6], binary[7]]); | |
let mut string = format!("S-{}-{}", version, authority); | |
let binary = &binary[8..]; | |
assert_eq!(binary.len(), 4 * length); | |
for i in 0..length { |
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
package main | |
import ( | |
"bytes" | |
"fmt" | |
"log" | |
"math/rand" | |
"os" | |
"strings" | |
"time" |
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
package main | |
import ( | |
"gorm.io/driver/sqlite" | |
"gorm.io/gorm" | |
) | |
type job1 struct { | |
ID int `gorm:"primaryKey"` | |
UniqueField1 string |
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
package main | |
import ( | |
"bytes" | |
"crypto/sha256" | |
"encoding/base64" | |
"encoding/json" | |
"fmt" | |
"net/http" | |
"strings" |
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
package com.example.mvc | |
import org.springframework.web.bind.annotation.GetMapping | |
import org.springframework.web.bind.annotation.RestController | |
import java.lang.Thread.sleep | |
import java.util.concurrent.CompletableFuture | |
import java.util.concurrent.ExecutorService | |
import java.util.concurrent.Executors | |
@RestController |
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
# You must first install apktool (https://github.com/iBotPeaches/Apktool) and android SDK | |
# and decompile apk using it | |
# apktool d -rf my-app.apk | |
# then generate a key for sign in: | |
# keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000 | |
rm signed-app.apk | |
apktool b -f -d com.myapp | |
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore com.myapp/dist/com.myapp.apk alias_name | |
zipalign -v 4 com.myapp/dist/com.myapp.apk signed-app.apk |
NewerOlder