Skip to content

Instantly share code, notes, and snippets.

View reasonset's full-sized avatar

MASAKI Haruka reasonset

View GitHub Profile
#!/usr/bin/ruby
require 'set'
lib = Set.new
ARGV.each do |dir|
Dir.glob("#{dir}/**/*.rb").each do |rb|
File.foreach(rb) do |line|
if line =~ /^\s*require\s+["'](.*?)["']\s*$/
lib_str = $1
break if lib_str[0, 8] == "bundler/" # Skip file using bundler.
diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex
index 14414adc4..1b6d0cced 100644
--- a/lib/pleroma/user.ex
+++ b/lib/pleroma/user.ex
@@ -440,6 +440,7 @@ defp fix_follower_address(params), do: params
def remote_user_changeset(struct \\ %User{local: false}, params) do
bio_limit = Config.get([:instance, :user_bio_length], 5000)
name_limit = Config.get([:instance, :user_name_length], 100)
+ fields_limit = Config.get([:instance, :max_remote_account_fields], 0)
@reasonset
reasonset / cpu-governor-controller.zsh
Created August 13, 2023 22:30
Quick change CPU governor from systray.
#!/bin/zsh
SUDO_COMMAND=pkexec
#SUDO_COMMAND=gksu
#SUDO_COMMAND=kdesu
avilable_governors=($(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors))
#avilable_governors=(powersave performance)
#avilable_governors=(powersave schedutil performance)
#!/bin/bash
function build_repoliststr {
ruby -ryaml -e 'print YAML.load(ARGF).map {|i| i.join(":::") }.join("%%%")' $HOME/.config/reasonset/workrepos.yaml
}
export repoliststr="$(build_repoliststr)"
function splitrepos {
echo $repoliststr | sed 's:%%%:\n:g'
@reasonset
reasonset / mkpwd.rb
Last active February 22, 2020 21:09
#!/usr/bin/ruby
# -*- mode: ruby; coding: utf-8 -*-
pwlength = ARGV.shift&.to_i || 64
pwlength = 64 if pwlength < 1
converter_symbols = ARGV.shift&.each_char
converter = converter_symbols ? ("a" .. "z").to_a + ("A" .. "Z").to_a + ("0" .. "9").to_a + converter_symbols : ('!' .. '~').to_a
#!/usr/bin/python
import sys
from PyQt5.QtCore import *
from PyQt5.QtWidgets import QApplication
from PyQt5.QtWebEngineWidgets import *
app = QApplication(sys.argv)
web = QWebEngineView()
@reasonset
reasonset / join-contexts.rb
Created August 26, 2019 09:37
Stella LogicのContextsを結合する
#!/usr/bin/ruby
require 'yaml'
logic = {}
File.open(ARGV.shift) do |f|
logic = YAML.load f
end
@reasonset
reasonset / temporary-disable-device.zsh
Created April 22, 2018 11:32
Turn on/off device with xinput and zenity.
#!/usr/bin/zsh
setopt EXTENDED_GLOB
device="$(zenity --title="Select Device" --width=600 --height=500 --list --column="DEVICES" "${(f)$(xinput --list | ruby -e 'print ARGF.each.map {|i| i =~ /[^A-Za-z]*([A-za-z1-9 ]+[a-zA-Z0-9])\s*id=(\d+)/; "#$2 #$1\n" }.join.chomp')}"| perl -ne '/\d+/; print $&;')"
if (( $? == 0 )) && [[ -n $device ]]
then
action="$(zenity --list --column="ACTION" "turn on" "turn off")"
if (( $? == 0 )) && [[ -n $action ]]
then
#!/bin/zsh
#### Default Settings ####
hts_voicefile=/usr/share/open-jtalk/voices/mei_normal.htsvoice
mecab_dictdir=/usr/share/open-jtalk/dic/
jtalk_tuning=(-a 0.6 -r 0.8 -fm -2.0 -jf 1.5)
jtalk_tmpfile=$HOME/tmp/forcedtodo.wav
notify_interval=180
notify_time=15000
task_editor=mousepad
#!/usr/bin/zsh
# Generate HTML files from Markdown files.
# It convert foo/bar.md to foo/bar.html
# This needs Pandoc.
STYLE_FILE="$HOME/local/repos/markdown-css/build/github/github.css"
BODY_CLASS="github"
PANDOC_OPTS=(-s --self-contained -t html5 -c $STYLE_FILE --toc)
for i in **/*.md