Skip to content

Instantly share code, notes, and snippets.

View guilt's full-sized avatar
🎯
Focusing

Karthik Kumar Viswanathan guilt

🎯
Focusing
View GitHub Profile
@guilt
guilt / Pi Setup Steps.md
Last active April 13, 2024 06:54
Raspberry and Orange Setup Steps

Raspberry Pi Setup Steps

  1. Make the Box Ready. Either Keep the Box or Attach the Racking Unit
  2. Write Image, note down Hostname
  3. Install MicroSD Card
  4. Connect PoE and Reboot

Raspberry Pi Imaging Manual

  1. Use rapios-lite
@guilt
guilt / SDCascade.py
Last active March 6, 2024 06:29
Stable Diffusion
import os
from accelerate import Accelerator
from diffusers import StableCascadeDecoderPipeline, StableCascadePriorPipeline
from slugify import slugify
import torch
priorModelId = "stabilityai/stable-cascade-prior"
modelId = "stabilityai/stable-cascade"
dataType = torch.float32 #16 is buggy
@guilt
guilt / spiral.py
Last active December 13, 2023 14:05
Spiral Iterator
# pylint: disable=invalid-name
"Spiral iterator."
import sys
if sys.version_info[0] >= 3:
xrange = range
def revrange(b, a=0, step=1):
"Reverse iterator."
return xrange(b-step, a-step, -step)
@guilt
guilt / zigzag.py
Last active December 13, 2023 14:04
ZigZag Iterator
# pylint: disable=invalid-name
# pylint: disable=unused-argument
"ZigZag iterator."
import sys
if sys.version_info[0] >= 3:
xrange = range
def move(x, y, columns, rows):
"Tells us what to do next with x and y."
@guilt
guilt / dll2lib.cmd
Last active December 13, 2023 14:03
Generate Import Libraries from a DLL
@echo off
REM Usage: dll2lib some-file.dll
REM
REM Generates libsome-lib.a, some-file.lib from some-file.dll,
REM making an intermediate some-file.def from the results of
REM dumpbin /exports some-file.dll.
REM
REM Currently must run without path on DLL.
REM (Fix by removing path when of lib_name for LIBRARY line below?)
REM
@guilt
guilt / bgrep.c
Last active December 13, 2023 14:02
Binary Grep and Binary Pattern Replace
#include <stdio.h>
#include <string.h>
void usage(char* progname) {
fprintf(stderr, "%s pattern [files]\n", progname);
}
void search(char* pattern, FILE* in, char* prefix) {
int c;
unsigned long long offset = 0;
@guilt
guilt / jar-verify.sh
Last active December 13, 2023 14:01
Java Archive Verifier
#!/bin/sh
# Usage: jar-verify FILE-OR-DIR-TO-VERIFY
#
# Histogram: ./jar-verify test.jar | cut -d: -f 2 | uniq -c | sort -rn
which which 2>&1 >/dev/null || { echo "Ensure Which is Installed."; exit 1; }
which file 2>&1 >/dev/null || { echo "Ensure File Type Detector - file is Installed."; exit 1; }
which unzip 2>&1 >/dev/null || { echo "Ensure Unzip is Installed."; exit 1; }
[ -z "$TMPDIR " ] && { TMPDIR=/tmp; echo "Temporary Directory is now: $TMPDIR"; }
@guilt
guilt / socks-kio-slave.diff
Last active December 13, 2023 14:00
Allows KDE3 to actually use Socks Proxy correctly
--- kdelibs-3.5.7/kioslave/http/http.cc 2007-05-14 13:22:34.000000000 +0530
+++ kdelibs-3.5.7/kioslave/http/http.cc 2007-08-03 03:44:27.000000000 +0530
@@ -2048,13 +2048,19 @@
kdDebug(7113) << "(" << m_pid << ") HTTPProtocol::httpOpenConnection" << endl;
setBlockConnection( true );
- // kio_http uses its own proxying:
- KSocks::self()->disableSocks();
if ( m_state.doProxy )
@guilt
guilt / nsf-ctf.c
Last active December 13, 2023 13:59
NSF hosted CTF ca. 2007
//Centralized password authentication server.
//Written by clever kid.
#include <netlib.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#define PASSFILE "password.txt"
@guilt
guilt / build-logstash.sh
Last active December 13, 2023 13:58
Build your own Logstash to test Logstash Plugins
#!/bin/sh
exec ./gradlew build \
-x :logstash-core:javaTests \
-x :logstash-core:rubyTests \
-x logstash-integration-tests:integrationTests \
-x benchmark-cli:test \
"$@"