Skip to content

Instantly share code, notes, and snippets.

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

Sani khursani8

🏠
Working from home
View GitHub Profile
@rylev
rylev / rust-in-large-organizations-notes.md
Last active June 12, 2025 16:06
Rust in Large Organizations Notes

Rust in Large Organizations

Initially taken by Niko Matsakis and lightly edited by Ryan Levick

Agenda

  • Introductions
  • Cargo inside large build systems
  • FFI
  • Foundations and financial support
def prefix_beam_search(ctc,
alphabet,
blank_token,
end_token,
space_token,
lm,
k=25,
alpha=0.30,
beta=5,
prune=0.001):
@thomwolf
thomwolf / top-k-top-p.py
Last active October 25, 2025 20:25
Sample the next token from a probability distribution using top-k and/or nucleus (top-p) sampling
def top_k_top_p_filtering(logits, top_k=0, top_p=0.0, filter_value=-float('Inf')):
""" Filter a distribution of logits using top-k and/or nucleus (top-p) filtering
Args:
logits: logits distribution shape (vocabulary size)
top_k >0: keep only top k tokens with highest probability (top-k filtering).
top_p >0.0: keep the top tokens with cumulative probability >= top_p (nucleus filtering).
Nucleus filtering is described in Holtzman et al. (http://arxiv.org/abs/1904.09751)
"""
assert logits.dim() == 1 # batch size 1 for now - could be updated for more but the code would be less clear
top_k = min(top_k, logits.size(-1)) # Safety check

Try more architectures
Basic architectures are sometimes better
Try other forms of ensembling than cv
Blend with linear regression
Rely more on shakeup predictions
Make sure copied code is correct
Pay more attention to correlations between folds
Try not to extensively tune hyperparameters
Optimizing thresholds can lead to "brittle" models
Random initializations between folds might help diversity\

@ines
ines / those_generously_buttered_noodles.py
Last active July 23, 2023 12:25
Using spaCy & NLP to create variations of "those generously buttered noodles"
# Using spaCy & NLP to create variations of "those generously buttered noodles"
# See here: https://twitter.com/ArielDumas/status/1086294656957272065
#
# Disclaimer 1: This is a quick, simplified example focusing on one particular
# sentence. There are obviously many more different constructions and
# different types of dependencies you want to cover. Some aspects also become
# significantly more difficult if you're working with, say, German instead of
# English.
#
# Disclaimer 2: Creating spam comments is a very bad use case for NLP and
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cwerner
cwerner / Guitar_GuidedGradCAM.ipynb
Last active August 1, 2019 04:44
Guided GradCAM Visualisation Guitars
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@diewland
diewland / wav2flac.py
Last active February 5, 2023 10:37
convert wav to flac from python
from os.path import splitext
from pydub import AudioSegment
def wav2flac(wav_path):
flac_path = "%s.flac" % splitext(wav_path)[0]
song = AudioSegment.from_wav(wav_path)
song.export(flac_path, format = "flac")
if __name__ == "__main__":
import sys
@madebyollin
madebyollin / make_audiobook.py
Last active June 6, 2025 07:24
Converts an epub or text file to audiobook via Google Cloud TTS
#!/usr/bin/env python3
"""
To use:
1. install/set-up the google cloud api and dependencies listed on https://github.com/GoogleCloudPlatform/python-docs-samples/tree/master/texttospeech/cloud-client
2. install pandoc and pypandoc, also tqdm
3. create and download a service_account.json ("Service account key") from https://console.cloud.google.com/apis/credentials
4. run GOOGLE_APPLICATION_CREDENTIALS=service_account.json python make_audiobook.py book_name.epub
"""
import re
import sys
@mackwage
mackwage / windows_hardening.cmd
Last active March 29, 2026 16:34
Script to perform some hardening of Windows OS
:: Windows 10 Hardening Script
:: This is based mostly on my own personal research and testing. My objective is to secure/harden Windows 10 as much as possible while not impacting usability at all. (Think being able to run on this computer's of family members so secure them but not increase the chances of them having to call you to troubleshoot something related to it later on). References for virtually all settings can be found at the bottom. Just before the references section, you will always find several security settings commented out as they could lead to compatibility issues in common consumer setups but they're worth considering.
:: Obligatory 'views are my own'. :)
:: Thank you @jaredhaight for the Win Firewall config recommendations!
:: Thank you @ricardojba for the DLL Safe Order Search reg key!
:: Thank you @jessicaknotts for the help on testing Exploit Guard configs and checking privacy settings!
:: Best script I've found for Debloating Windows 10: https://github.com/Sycnex/Windows10Debloater
: