Skip to content

Instantly share code, notes, and snippets.

View ssghost's full-sized avatar
🏠
Working from home

Stardust Song ssghost

🏠
Working from home
View GitHub Profile
@ssghost
ssghost / MD_BUTTONS_DOCS.md
Created May 18, 2024 04:07 — forked from cxmeel/MD_BUTTONS_DOCS.md
Documentation for markdown buttons.

Markdown Buttons

A collection of SVG buttons for displaying custom "buttons" in Markdown content. You are free to use these buttons wherever you like. All buttons were created in Figma, with (most) icons provided by the Iconify plugin.

Sponsor on GitHub View Itch.io Store

The SVG files can be found on this gist. They have been separated in order to reduce the amount of lag when loading this README file.

@ssghost
ssghost / gui.c
Created February 10, 2024 11:07 — forked from nir9/gui.c
Simple X11 Window Creation in C - Not for production, only for fun (gcc gui.c -lX11)
#include <X11/Xlib.h>
int main() {
XEvent event;
Display* display = XOpenDisplay(NULL);
Window w = XCreateSimpleWindow(display, DefaultRootWindow(display), 50, 50, 250, 250, 1, BlackPixel(display, 0), WhitePixel(display, 0));
XMapWindow(display, w);
XSelectInput(display, w, ExposureMask);
for (;;) {
@ssghost
ssghost / commons-proxy.sh
Created January 7, 2024 08:12 — forked from EudesSilva/commons-proxy.sh
Config proxy in Git, Yarn, Bower, NPM, Maven, Docker, Gradle, General
#Configuration Proxy
#Git
git config --global http.proxy http://<username>:<password>@<proxy-port>
git config --global https.proxy http://<username>:<password>@<proxy-port>
import gymnasium as gym
import numpy as np
from gymnasium.envs.mujoco.mujoco_env import MujocoEnv
# Env initialization
env = gym.make("Swimmer-v4", render_mode="human")
# Wrap to have reward statistics
env = gym.wrappers.RecordEpisodeStatistics(env)
mujoco_env = env.unwrapped
n_joints = 2
git clone https://github.com/cpacker/MemGPT.git
conda create -n memgpt python=3.10
conda activate memgpt
cd memgpt
pip install -r requirements.txt
export OPENAI_API_KEY="YOUR_API_KEY"
# download .txt docs from: https://huggingface.co/datasets/MemGPT/example-sec-filings/tree/main
# place in "memgpt/personas/examples/preload_archival/*.txt"
python3 main.py --archival_storage_files_compute_embeddings="memgpt/personas/examples/preload_archival/*.txt" --persona=memgpt_doc --human=basic
@ssghost
ssghost / llama2-mac-gpu.sh
Created July 20, 2023 00:58 — forked from adrienbrault/llama2-mac-gpu.sh
Run Llama-2-13B-chat locally on your M1/M2 Mac with GPU inference. Uses 10GB RAM
# Clone llama.cpp
git clone https://github.com/ggerganov/llama.cpp.git
cd llama.cpp
# Build it
LLAMA_METAL=1 make
# Download model
export MODEL=llama-2-13b-chat.ggmlv3.q4_0.bin
wget "https://huggingface.co/TheBloke/Llama-2-13B-chat-GGML/resolve/main/${MODEL}"

GitHub Search Syntax for Finding API Keys/Secrets/Tokens

As a security professional, it is important to conduct a thorough reconnaissance. With the increasing use of APIs nowadays, it has become paramount to keep access tokens and other API-related secrets secure in order to prevent leaks. However, despite technological advances, human error remains a factor, and many developers still unknowingly hardcode their API secrets into source code and commit them to public repositories. GitHub, being a widely popular platform for public code repositories, may inadvertently host such leaked secrets. To help identify these vulnerabilities, I have created a comprehensive search list using powerful search syntax that enables the search of thousands of leaked keys and secrets in a single search.

Search Syntax:

(path:*.{File_extension1} OR path:*.{File_extension-N}) AND ({Keyname1} OR {Keyname-N}) AND (({Signature/pattern1} OR {Signature/pattern-N}) AND ({PlatformTag1} OR {PlatformTag-N}))

Examples:

**1.

@ssghost
ssghost / delhist.sh
Last active June 11, 2023 03:44 — forked from maurelian/gist:859d8bbce79ef8facdd9eb8493f9b029
A zsh function to delete n lines of .zsh_history
delhist() {
local num_lines="$1"
local file="$HOME/.zsh_history"
if [[ ! "$num_lines" =~ ^[0-9]+$ ]]; then
echo "Invalid number of lines: $num_lines"
return 1
fi
local total_lines=$(wc -l < "$file")
@ssghost
ssghost / brew-upall.sh
Last active June 7, 2023 05:11 — forked from mikker/gist:631106
Update all packages installed with homebrew
brew update && brew upgrade && brew cleanup
#pip install git+https://github.com/huggingface/transformers.git
import datetime
import sys
from transformers import pipeline
from transformers.pipelines.audio_utils import ffmpeg_microphone_live
pipe = pipeline("automatic-speech-recognition", model="openai/whisper-base", device=0)
sampling_rate = pipe.feature_extractor.sampling_rate