Lecture 1: Introduction to Research — [📝Lecture Notebooks] [
Lecture 2: Introduction to Python — [📝Lecture Notebooks] [
Lecture 3: Introduction to NumPy — [📝Lecture Notebooks] [
Lecture 4: Introduction to pandas — [📝Lecture Notebooks] [
Lecture 5: Plotting Data — [📝Lecture Notebooks] [[
Discover gists
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This script performs search of specific directory up to 2 depth and change directory into it. | |
# This is helpful for cases like having many repositories and need to cd into it. | |
# Install | |
# 1. Install fzf(https://github.com/junegunn/fzf#related-projects). eg: sudo apt install fzf ( | |
# 2. Copy this source and paste into paste into your: nano ~/.bashrc | |
# 3. Edit the srchDir variable for your environment | |
# 4. Save and start new session of terminal | |
# Usage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ req ] | |
default_bits = 2048 | |
default_keyfile = server-key.pem | |
distinguished_name = subject | |
req_extensions = req_ext | |
x509_extensions = x509_ext | |
string_mask = utf8only | |
[ subject ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from moviepy.editor import * | |
from moviepy.video.tools.subtitles import SubtitlesClip | |
generator = lambda txt: TextClip(txt, font='Arial', fontsize=16, color='white') | |
subtitles = SubtitlesClip("somet.srt", generator) | |
video = VideoFileClip("some.mp4") | |
result = CompositeVideoClip([video, subtitles.set_pos(('center','bottom'))]) | |
result.write_videofile("out.mp4", fps=video.fps, temp_audiofile="temp-audio.m4a", remove_temp=True, codec="libx264", audio_codec="aac") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
autoload -Uz compinit && compinit | |
autoload -Uz add-zsh-hook | |
autoload -Uz vcs_info | |
add-zsh-hook precmd vcs_info | |
zstyle ':vcs_info:*' enable git | |
zstyle ':vcs_info:*' formats " %F{cyan}%c%u(%b)%f" | |
zstyle ':vcs_info:*' actionformats " %F{cyan}%c%u(%b)%f %a" | |
zstyle ':vcs_info:*' stagedstr "%F{green}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
def batch_rename_files(directory, prefix): | |
""" | |
Renames all files in the given directory with the given prefix followed by a sequential number, | |
keeping their original file extensions intact. This can be useful for organizing a large number | |
of files in a systematic way, such as photos from an event, downloaded files, etc. | |
Parameters: | |
- directory: The path to the directory containing the files to be renamed. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from transformers import pipeline, T5Tokenizer | |
def summarize_text(text, max_length=130, min_length=30, model_name='t5-small'): | |
""" | |
Summarizes long texts using a pre-trained model from Hugging Face's Transformers. | |
This enhanced version includes functionality to handle large texts by breaking them | |
into manageable chunks, addressing the token limit constraint of the model. | |
Parameters: | |
- text: The text to be summarized. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEditor; | |
using UnityEditor.SceneManagement; | |
// Adds a "Edit Prefab" option in the Assets menu (or right clicking an asset in the project browser). | |
// This opens an empty scene with your prefab where you can edit it. | |
// Put this script in your project as Assets/Editor/EditPrefab.cs | |
public class EditPrefab { | |
static Object getPrefab(Object selection) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hashlib | |
import json | |
from time import time | |
import binascii | |
from collections import OrderedDict | |
from uuid import uuid4 | |
from cryptography.hazmat.primitives import hashes | |
from cryptography.hazmat.primitives.asymmetric import ec | |
from cryptography.hazmat.primitives import serialization | |
from cryptography.exceptions import InvalidSignature |
NewerOlder