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 / script.sh
Created April 30, 2022 19:01
Script starter boilerplate
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
gcloud beta iap oauth-clients list
@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")
@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 / 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 / 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";
# If we are a computer with nix available, then use that to setup
# the build environment with exactly what we need.
if has nix; then
use flake
fi
# Automatically setup a virtualenv
layout python
# Add well known WSL CUDA library
@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 / 📊 Weekly development breakdown
Last active February 14, 2024 00:14
Weekly weekly dev (╯°□°)╯︵ ┻━┻
Python 57 mins █████████▌░░░░░░░░░░░ 45.8%
Bash 30 mins █████░░░░░░░░░░░░░░░░ 24.2%
YAML 16 mins ██▊░░░░░░░░░░░░░░░░░░ 13.1%
Nix 10 mins █▊░░░░░░░░░░░░░░░░░░░ 8.3%
JSON 6 mins █░░░░░░░░░░░░░░░░░░░░ 5.3%
@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