Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View sify21's full-sized avatar
🌴
On vacation

sify21

🌴
On vacation
View GitHub Profile
@sify21
sify21 / Git_Behind_Proxy.md
Last active January 2, 2023 10:48 — forked from ozbillwang/Git_Behind_Proxy.md
Configure Git to use a proxy (https or SSH+GIT)
@sify21
sify21 / GitConfigHttpProxy.md
Created January 2, 2023 09:47 — forked from evantoli/GitConfigHttpProxy.md
Configure Git to use a proxy

Configure Git to use a proxy

In Brief

You may need to configure a proxy server if you're having trouble cloning or fetching from a remote repository or getting an error like unable to access '...' Couldn't resolve host '...'.

Consider something like:

@sify21
sify21 / aes_gcm_siv.go
Last active September 30, 2021 10:18
aes-gcm-siv implementation in go. A direct translation of https://github.com/bjornedstrom/aes-gcm-siv-py
package aead
import (
"crypto/aes"
"encoding/binary"
"errors"
"math/big"
)
var _mod = big.NewInt(0)
@sify21
sify21 / pwdx_for_mac.bash
Last active September 15, 2021 03:48 — forked from tobym/pwdx_for_mac.bash
pwdx for mac. Usage: pwx pid
function pwdx {
lsof -a -d cwd -p $1 -n -Fn | awk '/^n/ {print substr($0,2)}'
}
@sify21
sify21 / aes.js
Last active September 2, 2021 07:05
aes-gcm-siv implementation using node-forge. A direct translation of https://github.com/bjornedstrom/aes-gcm-siv-py
const forge = require('node-forge');
forge.options.usePureJavaScript = true;
class Field {
static _MOD = [0n, 121n, 126n, 127n, 128n].map(i => 1n << i).reduce(((previousValue, currentValue) => previousValue + currentValue));
static _INV = [0n, 114n, 121n, 124n, 127n].map(i => 1n << i).reduce(((previousValue, currentValue) => previousValue + currentValue));
static add(x, y) {
return x ^ y;
}
@sify21
sify21 / howToModifyOvaFile.md
Created August 29, 2021 15:40 — forked from goodjob1114/howToModifyOvaFile.md
how to modify .ova file on linux/Mac using terminal....export vm (OVF 1.0) from virtualbox, then modify some tag and hash value for import vm to ESXi

extract ova files from an archive

$ tar -xvf vmName.ova

modify ovf for some invalid tag

$ vi vmName.ovf
@sify21
sify21 / pyproject.toml
Last active April 15, 2021 09:17
pyproject.toml
[tool.poetry]
name = "test"
version = "0.1.0"
description = ""
authors = ["sify21 <sify1221@gmail.com>"]
[tool.poetry.dependencies]
python = ">=3.6,<4.0"
jsonschema = "^3.2.0"
@sify21
sify21 / build.sh
Last active February 16, 2023 11:04
build static native image with graal
# build gcc toolchain targeting x86_64-linux-musl with https://github.com/richfelker/musl-cross-make
# don't use master branch which uses musl v1.2.1(the new malloc implementation has deadlock problems, v1.2.2 fixes it, v1.2.0 doesn't have it)
cd ~
git clone https://github.com/richfelker/musl-cross-make -b v0.9.9
cd musl-cross-make
cp config.mak.dist config.mak
# edit config.mak: TARGET = x86_64-linux-musl
# edit cowpatch.sh to fix an error, add "OPTIND=1" after line 56. see https://github.com/richfelker/musl-cross-make/issues/86
# ensure you have g++, on fedora it's "dnf install gcc-c++"
make -j`nproc`
#[cfg(test)]
mod test {
use casbin::{CoreApi, DefaultModel, Enforcer, MemoryAdapter, MgmtApi};
use serde::{Deserialize, Serialize};
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
pub struct Claims {
pub id: i64,
pub username: String,
pub resources: Vec<String>,
package main
import (
"fmt"
"log"
"net/http"
)
func init() {
log.SetFlags(log.Lshortfile)