Skip to content

Instantly share code, notes, and snippets.

@jasmas
jasmas / acdisable
Created January 26, 2022 17:29
Enable/Disable Cisco AnyConnect Socket Filter Extension on MacOS
#!/bin/sh
echo Disabling vpnagentd...
sudo launchctl disable system/com.cisco.anyconnect.vpnagentd
echo Tearing down vpnagentd...
sudo launchctl bootout system /Library/LaunchDaemons/com.cisco.anyconnect.vpnagentd.plist
echo Deactivating Cisco AnyConnect Socket Filter Extension...
/Applications/Cisco/Cisco\ AnyConnect\ Socket\ Filter.app/Contents/MacOS/Cisco\ AnyConnect\ Socket\ Filter -deactivateExt
#!/bin/zsh
# WARNING! The script is meant to show how and what can be disabled. Don’t use it as it is, adapt it to your needs.
# Credit: Original idea and script disable.sh by pwnsdx https://gist.github.com/pwnsdx/d87b034c4c0210b988040ad2f85a68d3
# Disabling unwanted services on macOS Big Sur (11), macOS Monterey (12), macOS Ventura (13) and macOS Sonoma (14)
# Disabling SIP is required ("csrutil disable" from Terminal in Recovery)
# Modifications are written in /private/var/db/com.apple.xpc.launchd/ disabled.plist, disabled.501.plist
# To revert, delete /private/var/db/com.apple.xpc.launchd/ disabled.plist and disabled.501.plist and reboot; sudo rm -r /private/var/db/com.apple.xpc.launchd/*
# user
@ctlllll
ctlllll / longest_chinese_tokens_gpt4o.py
Created May 13, 2024 19:53
Longest Chinese tokens in gpt4o
import tiktoken
import langdetect
T = tiktoken.get_encoding("o200k_base")
length_dict = {}
for i in range(T.n_vocab):
try:
length_dict[i] = len(T.decode([i]))
except:
@yellowbyte
yellowbyte / compiling_asm.md
Last active May 15, 2024 07:32
how to assemble assembly with NASM assembler to 32-bit or 64-bit ELF binary with or without libc

32-bit ELF binary

how to assemble and link:

nasm -f elf32 -o <filename>.o <filename>.asm
ld -m elf_i386 -o <filename> <filename>.o

template code (hello world):

section .text
global _start
@joyrexus
joyrexus / README.md
Last active May 15, 2024 07:30
Perl one-liners

Hi:

perl -e 'print "hello world!\n"'

A simple filter:

perl -ne 'print if /REGEX/'

Filter out blank lines (in place):

@rBrenick
rBrenick / split_subtitle_file_into_multiline.py
Last active May 15, 2024 07:29
Take an .srt file and split the text line if the character count goes above a certain threshold.
import sys
import argparse
"""
Example usecase:
python split_srt_lines.py SUBTITLE_FILE_PATH.srt -o OUTPUT_FILE_PATH.srt --max_line_length=42 --comma_split_percent=75
if you don't specify an output path, it will replace the file content of the input file
@u130b8
u130b8 / build.cmd
Created May 14, 2024 19:53
Build Wireshark plugins on Windows without CMake and Qt
@echo off
setlocal EnableDelayedExpansion
set DIR_ROOT=%~dp0.
set DIR_SRC=%DIR_ROOT%\src
set DIR_BUILD=%DIR_ROOT%\build
set DIR_WIRESHARK=%DIR_BUILD%\wireshark
set DIR_WINFLEXBISON=%DIR_BUILD%\winflexbison
set DIR_WIRESHARK_X64_LIBS=%DIR_BUILD%\wireshark-x64-libs
set DIR_WSBUILD64=%DIR_BUILD%\wsbuild64
@nhibberd
nhibberd / gist:9d78576aab943cdb0f6c
Created June 23, 2014 00:41
Zsh case insensitivity auto complete
## case-insensitive (uppercase from lowercase) completion
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
## case-insensitive (all) completion
#zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'
## case-insensitive,partial-word and then substring completion
#zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active May 15, 2024 07:24
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example