Skip to content

Instantly share code, notes, and snippets.

View DaniruKun's full-sized avatar
:octocat:
Processing...

Daniils Petrovs DaniruKun

:octocat:
Processing...
View GitHub Profile
@DaniruKun
DaniruKun / presigned-test.rb
Created July 10, 2023 12:54
Presigned upload example in Ruby
#!/usr/bin/env ruby
require "aws-sdk-s3"
require "net/http"
# Creates a presigned URL that can be used to upload content to an object.
#
# @param bucket [Aws::S3::Bucket] An existing Amazon S3 bucket.
# @param object_key [String] The key to give the uploaded object.
# @return [URI, nil] The parsed URI if successful; otherwise nil.
@DaniruKun
DaniruKun / .iex.exs
Created January 31, 2023 16:44
My custom global IEx script file that is preloaded before each IEx session. Adds some convenience functions.
IO.puts("Using .iex.exs file loaded from #{__DIR__}/.iex.exs")
defmodule Util do
def atom_status do
limit = :erlang.system_info(:atom_limit)
count = :erlang.system_info(:atom_count)
IO.puts("Currently using #{count} / #{limit} atoms")
end
@DaniruKun
DaniruKun / whisper-transcribe.bash
Last active March 31, 2024 01:50
Transcribe (and translate) any VOD (e.g. from Youtube) using Whisper from OpenAI and embed subtitles!
#!/usr/bin/env bash
# Small shell script to more easily automatically download and transcribe live stream VODs.
# This uses YT-DLP, ffmpeg and the CPP version of Whisper: https://github.com/ggerganov/whisper.cpp
# Use `./transcribe-vod help` to print help info.
# MIT License
# Copyright (c) 2022 Daniils Petrovs
@DaniruKun
DaniruKun / macOS-enable-repeated-keys.sh
Last active May 14, 2022 15:28
Disable Apple press and hold for VS Code
defaults delete -g ApplePressAndHoldEnabled
defaults write com.microsoft.VSCode ApplePressAndHoldEnabled -bool false # For VS Code
defaults write com.microsoft.VSCodeInsiders ApplePressAndHoldEnabled -bool false # For VS Code Insider
defaults write com.visualstudio.code.oss ApplePressAndHoldEnabled -bool false # For VS Codium
defaults write com.microsoft.VSCodeExploration ApplePressAndHoldEnabled -bool false # For VS Codium Exploration users
# If the domain is wrong or you are not usre, you can also do:
# defaults write -app 'Visual Studio Code' ApplePressAndHoldEnabled -bool false
@DaniruKun
DaniruKun / foo.el
Created January 15, 2022 17:29
Example of a universal Emacs Package script
#!/usr/bin/env emacs --script
;;; foo.el --- Foo development and productivity utils -*- lexical-binding: t; -*-
;;;;; Commands
;;;###autoload
(defun bar ()
"Print foo bar."
(interactive)
(message "Foo Bar!"))

How to install Hercules source code analysis setup in 2022

Requirements

  • Python 3.7.10 or older
  • Tensorflow 1.14 or older
  • Labours 10.7.2 or older
python -m pip install tensorflow==1.14.0 labours==10.7.2
@DaniruKun
DaniruKun / discord-remove-signature.sh
Created September 7, 2021 14:25
Allow virtual webcam for Discord on macOS
sudo codesign --remove-signature /Applications/Discord.app/Contents/Frameworks/Discord\ Helper\ \(GPU\).app /Applications/Discord.app/Contents/Frameworks/Discord\ Helper\ \(Plugin\).app /Applications/Discord.app/Contents/Frameworks/Discord\ Helper\ \(Renderer\).app /Applications/Discord.app/Contents/Frameworks/Discord\ Helper.app
@DaniruKun
DaniruKun / .init.el
Created July 22, 2021 13:51
Dan's emacs config
;; Author: Daniils Petrovs
;; You will most likely need to adjust this font size for your system!
(defvar efs/default-font-size 180)
(defvar efs/default-variable-font-size 180)
;; Make frame transparency overridable
(defvar efs/frame-transparency '(100 . 100))
(set-frame-parameter (selected-frame) 'alpha '(100 100))
(add-to-list 'default-frame-alist '(alpha 100 100))
@DaniruKun
DaniruKun / yt-clip.sh
Created May 17, 2021 21:08
Download YT VOD in timestamp interval
youtube-dl -f "(bestvideo+bestaudio/best)[protocol!*=dash]" --external-downloader ffmpeg --external-downloader-args "-ss 00:00:00 -to 00:00:00" "youtube link"
#!/bin/sh
# Capture video from a UVC compliant webcam in a specific format and playback using ffplay
ffplay -f avfoundation \
-video_size 1920x1080 \
-framerate 30 \
-probesize 21M \
-pixel_format nv12 \
-i "H264:none"