Skip to content

Instantly share code, notes, and snippets.

View shikanime's full-sized avatar
🔮
Elixir Alchemist

Shikanime Deva shikanime

🔮
Elixir Alchemist
View GitHub Profile
@shikanime
shikanime / KVM-IOMMU-checkup_setp3.sh
Last active June 7, 2018 17:33
Ubuntu host KVM PCI passthough
# Check IOMMU is working
# To ensure IOMMU has been enabled, check for the string Directed I/O, which will be prefixed with either DMAR or PCI-DMA.
dmesg | grep -i 'Directed I/O'
@shikanime
shikanime / undervolt.ps1
Created January 12, 2020 02:39
Undervolt Intel
$status = get-service -name "XTU3SERVICE" | Select-Object {$_.status} | format-wide
if ($status -ne "Running") {
start-service -name "XTU3SERVICE"
}
& 'C:\Program Files (x86)\Intel\Intel(R) Extreme Tuning Utility\Client\XTUCli.exe' -t -id 34 -v -140
sleep 4
@shikanime
shikanime / .zshrc
Last active January 12, 2020 17:18
# Languages
export LC_ALL="en_US.UTF-8"
export LANG="en_US.UTF-8"
# Brew
export PATH="/home/linuxbrew/.linuxbrew/bin:$PATH"
export MANPATH="/home/linuxbrew/.linuxbrew/share/man:$MANPATH"
export INFOPATH="/home/linuxbrew/.linuxbrew/share/info:$INFOPATH"
# Windows
@shikanime
shikanime / index.ts
Last active December 16, 2021 20:34
Get MATIC/USDC pair via Uniwap
import { Token } from "@uniswap/sdk-core";
import { abi as IUniswapV3PoolABI } from "@uniswap/v3-core/artifacts/contracts/interfaces/IUniswapV3Pool.sol/IUniswapV3Pool.json";
import { Pool } from "@uniswap/v3-sdk";
import { ethers } from "ethers";
async function main() {
const provider = new ethers.providers.InfuraProvider();
const poolAddress = "0x07a6e955ba4345bae83ac2a6faa771fddd8a2011";
@shikanime
shikanime / hook.tsx
Last active January 26, 2022 01:17
Example of synchronizing the state of the recoil with the browser's geolocation API
import { useEffect } from "react";
import {
atom,
useRecoilCallback,
useRecoilValue,
useResetRecoilState,
useSetRecoilState,
} from "recoil";
export const optionsState = atom<PositionOptions>({
@shikanime
shikanime / main.tf
Created February 15, 2022 10:51
DBT documentation Terraform manifest using Cloud Run
terraform {
required_version = ">= 1.0.7"
required_providers {
google = {
source = "hashicorp/google"
version = "3.84.0"
}
google-beta = {
version = "3.84.0"
@shikanime
shikanime / clean.py
Last active February 15, 2022 10:52
List broken truncated images
import glob
from struct import unpack
marker_mapping = {
0xffd8: "Start of Image",
0xffe0: "Application Default Header",
0xffdb: "Quantization Table",
0xffc0: "Start of Frame",
0xffc4: "Define Huffman Table",
@shikanime
shikanime / main.py
Last active April 5, 2022 16:21
Stream request body to Google Cloud Storage
import shutil
from google.cloud import storage
from google.cloud.storage.blob import BlobWriter
import urllib.request
with urllib.request.urlopen("https://jsonplaceholder.typicode.com/todos/1") as f:
storage_client = storage.Client()
bucket = storage_client.get_bucket("cel-em-gcs-dpf-ing-01-dev")
blob = bucket.blob("foo.txt")
blob_file = blob.open(mode="wb", content_type="text/plain")
gcloud beta iap oauth-clients list
@shikanime
shikanime / script.sh
Created April 30, 2022 19:01
Script starter boilerplate
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail