Skip to content

Instantly share code, notes, and snippets.

View trickster's full-sized avatar
🎯
Focusing

Sivaram Konanki trickster

🎯
Focusing
View GitHub Profile
@trickster
trickster / hn-gpt-free.js
Created March 23, 2023 13:48 — forked from surprisetalk/hn-gpt-free.js
Userscript to hide any HackerNews story with "GPT" in its title.
// ==UserScript==
// @name HackerNews GPT-Free Feed
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Hides any Hacker News story with "GPT" in its title.
// @author Taylor Troesh
// @include https://news.ycombinator.com/*
// @grant none
// ==/UserScript==
@trickster
trickster / flake.nix
Created March 12, 2023 06:29
python flake
{
description = "Python dev shell";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
mach-nix.url = "github:davhau/mach-nix";
};
outputs = { self, nixpkgs, flake-utils, mach-nix, ... }:
flake-utils.lib.eachDefaultSystem
(system:
@trickster
trickster / net_lab_broadcast_domains.sh
Last active February 28, 2023 04:37 — forked from iximiuz/net_lab_broadcast_domains.sh
A bunch of helper functions to create Linux bridges, network namespaces, and interconnect everything using veth pairs.
#!/usr/bin/env bash
set -xeuo pipefail
create_bridge() {
local nsname="$1"
local ifname="$2"
echo "Creating bridge ${nsname}/${ifname}"
@trickster
trickster / native-mem-tracking.md
Created January 25, 2023 03:02 — forked from prasanthj/native-mem-tracking.md
Native memory tracking in JVM

Enable native memory tracking in JVM by specifying the following flag

-XX:NativeMemoryTracking=detail

Know the <PID> of the java process

jps

To print ps based RSS

ps -p <PID> -o pcpu,rss,size,vsize

To print native memory tracking summary

Preact, Without Build Tools

This is a demonstration of using Preact without any build tooling. The library is linked from the esm.sh CDN, however a standalone JS file exporting HTM + Preact + Hooks can also be downloaded here.

@trickster
trickster / zio-lmdb-basic.sc
Last active September 23, 2022 03:35 — forked from dacr/zio-lmdb-basic.sc
ZIO LMDB simple example / published by https://github.com/dacr/code-examples-manager #5c5fabdd-7f05-48d6-ae67-c8618b02284e/cc000abfc125180c0fd31e1573008fe900473514
//> using scala "3.2.0"
//> using javaOpt "--add-opens", "java.base/java.nio=ALL-UNNAMED", "--add-opens", "java.base/sun.nio.ch=ALL-UNNAMED"
//> using lib "fr.janalyse::zio-lmdb:0.0.1"
//> using lib "fr.janalyse::zio-worksheet:2.0.2.0"
// ---------------------
import zio.*
import zio.lmdb.*
import zio.json.*
import java.io.File
@trickster
trickster / zio-tapir-hello-world-1.sc
Last active September 22, 2022 05:04 — forked from dacr/tapir-zio-hello-world-1.sc
hello world http server (zhttp zio based) using tapir / published by https://github.com/dacr/code-examples-manager #fd3e1ee8-afe4-4c3d-a9fe-5e0f16a985ad/13816f2c088ef3450ae06339d4a9b4f6a5f653ce
// summary : hello world http server (zhttp zio based) using tapir
// keywords : scala, zio, tapir, http, zhttp, endpoints, @testable
// publish : gist
// authors : David Crosson
// license : Apache
// id : fd3e1ee8-afe4-4c3d-a9fe-5e0f16a985ad
// created-on : 2021-11-20T13:51:35+01:00
// managed-by : https://github.com/dacr/code-examples-manager
// run-with : scala-cli $file
// test-with : curl http://127.0.0.1:8080/hello
# To extract the sound from a video and save it as MP3:
ffmpeg -i <video.mp4> -vn <sound>.mp3
# To convert frames from a video or GIF into individual numbered images:
ffmpeg -i <video.mpg|video.gif> <frame_%d.png>
# To combine numbered images (frame_1.jpg, frame_2.jpg, etc) into a video or GIF:
ffmpeg -i <frame_%d.jpg> -f image2 <video.mpg|video.gif>
# To quickly extract a single frame from a video at time mm:ss and save it as a 128x128 resolution image:
@trickster
trickster / async.md
Last active February 9, 2022 02:11
Using both Tokio and async-std together

Option 1 using async-compat

// async-compat = "0.2.1"
// async-std = {version = "1.10.0"}
// tokio = { version = "1", features = ["full"] }
use async_compat::Compat;

async fn say_hello() {
 println!("Hello, world!");
@trickster
trickster / deps.edn
Created August 15, 2021 12:01 — forked from athos/deps.edn
Try `clojure -Sdeps '{:deps {hello-clojure {:git/url "https://gist.github.com/athos/b68b15b08efedffaf14d8c020b125202" :sha "1c9a05106171f97f9b8e8ac8f58c7bd8dbe021f9"}}}' -m hello-clojure` on your terminal
{:paths ["."]
:deps {clansi {:mvn/version "1.0.0"}}}