Skip to content

Instantly share code, notes, and snippets.

View joram77's full-sized avatar

Joram Declerck joram77

View GitHub Profile
<?php
return [
'class' => 'yii\db\Connection',
'dsn' => 'sqlite:/mnt/c/Users/user/calendy.sqlite',
'username' => 'root',
'password' => '_******_****',
'charset' => 'utf8',
zend_extension=xdebug.so
xdebug.mode=debug
xdebug.log=/var/log/xdebug.log
xdebug.idekey=PHPSTORM #Settings > Languages & Frameworks > PHP > Servers > localhost > [X] use path mappings > project files fill absolute path on server
xdebug.client_host=host.docker.internal #cat /etc/resolv.conf for the IP address of the Windows machine as seen from WSL 2 (the WSL 2 VM)
<%= form_tag 'topics/edit_all' do %>
<% @topics.each do |topic| %>
<%= fields_for "topics[]", topic do |f| %>
<%= f.check_box :enabled %>
<%= f.label topic["name"] %><br />
<% end %>
<% end %>
<%= submit_tag %>
<% end %>
@joram77
joram77 / ffmpeg-vid-to-jpeg.ps1
Last active October 22, 2023 09:14
ffmpeg convert video to images
.\ffmpeg.exe -i C:\Users\user\Downloads\20230212_105950.MOV -r 10 -f image2 output_%05d.jpg
.\ffmpeg.exe -i C:\Users\user\Downloads\20230212_105950.MOV -f image2 -vsync 0 output_%05d.png
# -skip_frame nokey
// given input#search, .my-menu a, .my-menu .sub-menu .a
jQuery(function(){
jQuery('#search').on('keyup',function(){
if(typeof(search_sidebar_timer)!='undefined'){
window.clearTimeout(search_sidebar_timer);
}
search_sidebar_timer = window.setTimeout(function(){
jQuery(".my-menu a").hide();
var txt_show_filter = jQuery('#search').val().toLowerCase().trim();
mysqldump -u USER -p --single-transaction --quick --lock-tables=false DATABASE | gzip > OUTPUT.gz
The mysqldump reference at dev.mysql.com even says...
To dump large tables, you should combine the --single-transaction option with --quick.
@joram77
joram77 / jaccard_recommendation.rb
Created September 27, 2023 06:46 — forked from otobrglez/jaccard_recommendation.rb
Simple recommendation system written in Ruby based on Jaccard index.
# Simple Recommendation Engine in Ruby
# Visit: http://otobrglez.opalab.com
# Author: Oto Brglez <otobrglez@gmail.com>
class Book < Struct.new(:title)
def words
@words ||= self.title.gsub(/[a-zA-Z]{3,}/).map(&:downcase).uniq.sort
end
SELECT FIELDS(ALL) FROM Account LIMIT 200
# Powershell script to split large sql files to separate sql files per table - joram77
$inputFile = "c:\users\money\dumps\db_slimmed.sql"
$fileInfo = New-Object System.IO.FileInfo($inputFile)
$newDir = $fileInfo.Directory.ToString() + '\' + $fileInfo.BaseName.ToString()
New-Item -ItemType Directory -Force -Path $newDir
$outputFile = "$newDir\db_slimmed_start.sql"
$reader = New-Object System.IO.StreamReader($inputFile)
$count = 0
docker cp ./.ssh/id_ed25519 container-name:/root/.ssh/id_rsa ; docker exec container-name bash -c "chmod 700 /root/.ssh/id_rsa"