Skip to content

Instantly share code, notes, and snippets.

View Yevgnen's full-sized avatar
🔥

Yevgnen Yevgnen

🔥
View GitHub Profile
@jimmychu0807
jimmychu0807 / string-conversion.rs
Created November 21, 2019 10:20
Conversion between String, str, Vec<u8>, Vec<char> in Rust
use std::str;
fn main() {
// -- FROM: vec of chars --
let src1: Vec<char> = vec!['j','{','"','i','m','m','y','"','}'];
// to String
let string1: String = src1.iter().collect::<String>();
// to str
let str1: &str = &src1.iter().collect::<String>();
// to vec of byte
@alphapapa
alphapapa / magit.sh
Last active April 5, 2020 10:18
Run a standalone Magit editor!
# Please see the script's new home: https://github.com/alphapapa/magit.sh
@gnanderson
gnanderson / fif.sh
Last active November 3, 2023 15:30
Find in file using ripgrep, then fuzzy find matched filenames with fzf, preview match using bat
fif() {
rg \
--column \
--line-number \
--no-column \
--no-heading \
--fixed-strings \
--ignore-case \
--hidden \
--follow \
@pvik
pvik / smartparens-cheatsheet.md
Last active December 16, 2024 17:54
A Cheatsheet for Emacs Smarparens example configuration

An animated cheatsheet for smartparens using the example configuration specified here by the smartparens author. Inspired by this tutorial for paredit.

Traversal

C-M-f sp-forward-sexp
C-M-b sp-backward-sexp
@HarshTrivedi
HarshTrivedi / pad_packed_demo.py
Last active April 17, 2025 01:26 — forked from Tushar-N/pad_packed_demo.py
Minimal tutorial on packing (pack_padded_sequence) and unpacking (pad_packed_sequence) sequences in pytorch.
import torch
from torch import LongTensor
from torch.nn import Embedding, LSTM
from torch.autograd import Variable
from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence
## We want to run LSTM on a batch of 3 character sequences ['long_str', 'tiny', 'medium']
#
# Step 1: Construct Vocabulary
# Step 2: Load indexed data (list of instances, where each instance is list of character indices)
@alanzchen
alanzchen / ChiMerge.ipynb
Last active April 17, 2024 17:29
ChiMerge implementation in Python 3.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1. Introduction to “This is Watson”
D. A. Ferrucci, "Introduction to “This is Watson”," in IBM Journal of Research and
Development, vol. 56, no. 3.4, pp. 1:1-1:15, May-June 2012.
doi: 10.1147/JRD.2012.2184356
Abstract: In 2007, IBM Research took on the grand challenge of building a computer
system that could compete with champions at the game of Jeopardy!™. In 2011, the
open-domain question-answering (QA) system, dubbed Watson, beat the two
highest ranked players in a nationally televised two-game Jeopardy! match. This
paper provides a brief history of the events and ideas that positioned our team to
take on the Jeopardy! challenge, build Watson, IBM Watson™, and ultimately
@hynekcer
hynekcer / results_in_teardown.py
Last active March 13, 2025 12:03
Getting Python's unittest results in a tearDown() method (my SO answer, question 4414234)
"""Getting Python's unittest results in a tearDown() method
https://stackoverflow.com/questions/4414234/getting-pythons-unittest-results-in-a-teardown-method#39606065
"""
import unittest
class MyTest(unittest.TestCase):
def tearDown(self):
if hasattr(self._outcome, 'errors'):
# Python 3.4 - 3.10 (These two methods have no side effects)
@troyfontaine
troyfontaine / 1-setup.md
Last active April 28, 2025 14:40
Signing your Git Commits on MacOS

Methods of Signing Git Commits on MacOS

Last updated March 13, 2024

This Gist explains how to sign commits using gpg in a step-by-step fashion. Previously, krypt.co was heavily mentioned, but I've only recently learned they were acquired by Akamai and no longer update their previous free products. Those mentions have been removed.

Additionally, 1Password now supports signing Git commits with SSH keys and makes it pretty easy-plus you can easily configure Git Tower to use it for both signing and ssh.

For using a GUI-based GIT tool such as Tower or Github Desktop, follow the steps here for signing your commits with GPG.

#![feature(test)]
extern crate test;
extern crate itertools;
use test::Bencher;
use itertools::Itertools;
fn strings_vec() -> Vec<String> {
vec![String::from("again"); 512]