Skip to content

Instantly share code, notes, and snippets.

@moksamedia
moksamedia / __init__.py
Created March 7, 2025 07:09
Audacity edit audios addon (fixed so that the file dialog works)
'''
This addon opens one or many audios in an editor (the default is Audacity).
It supports 3 modes to choose which audios it opens. The config is entered in a text box and the searching mode will automatically detected.
If users enter "first_field,second_field,third_field", this addon will open every audios in "first_field" and "second_field"
If users enter "1,2:1", this addon will opens the first and second audios in the front card and the first audio in the back card.
If users enter "<div id=“editable”>[sound: … ]</div>" and tick the regex box, it will search audios that are surrounded by <div id="editable"> tag.
On main window -> only show change path button
On review mode, only show search fields
First, implement search box
Which information do we need to save?
@moksamedia
moksamedia / export_csv.py
Created June 11, 2021 20:33 — forked from nillsondg/export_csv.py
Anki export to CSV add-on
# -*- coding: utf-8 -*-
"""Anki add-on which adds "Notes in CSV format" option of Export desc dialog.
Copyright (c) 2019 Alex Chekunkov, Dmitry Gordeev
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@moksamedia
moksamedia / gist:3a9dca10e293a52df8b96288ebdecc69
Created February 4, 2021 20:52
My double monitor setup for PopOS / Ubuntu using xrandr for HIDPI laptop and HD external monitor
#!/bin/sh
xrandr --output HDMI-0 --mode 1920x1080 --fb 7680x2160 --pos 0x0 --scale 2x2 --rotate normal \
--output eDP-1-1 --primary --mode 3840x2160 --scale 1x1 --pos 3840x0 --rotate normal
watchman watch-del-all
rm -rf node_modules
rm -rf package-lock.json
rm -rf ios/build
rm -rf $TMPDIR/react-*
npm cache clear --force -s
npm cache verify
cd ios
pod deintegrate
<?php
/**
* This code retrieves course data from an external API and displays it in the user's
* My Account area. A merchant has noticed that there's a delay when loading the page.
*
* 1) What changes would you suggest to reduce or remove that delay?
* 2) Is there any other code changes that you would make?
*/
public function add_my_courses_section() {
@moksamedia
moksamedia / unoct.php
Created July 30, 2015 23:13
Replaces escaped octal char codes in php with char
<?php
/**
* Created by PhpStorm.
* User: cantgetnosleep
* Date: 7/30/15
* Time: 4:50 PM
*/
$chars = array();
@moksamedia
moksamedia / gradle-cascade-eclipse-tasks
Created April 28, 2013 04:49
Gradle: when running the eclipse task, I usually want it to run on all subprojects as well. This will make sure that happens.
/*
* Automatically triggers subprojects' eclipse task when
* eclipse task is run on root project
*/
tasks.eclipse.dependsOn{
subprojects { Project subproj ->
subproj.tasks.eclipse
}
}
@moksamedia
moksamedia / gist:5475917
Created April 28, 2013 04:45
Gradle: to automatically discover subprojects and include them in your root project, put this in your settings.gradle file
/*
* Here we iterate over the directories found in the root directory of the
* main project, and if the subdirectory contains a build.gradle file, it
* is added to the main project as a subproject.
*/
Closure discoverSubprojects = {
def list = []
rootDir.eachDir(){ dir ->
dir.eachFileMatch({it == 'build.gradle'}, { list += [dir.name] })