Skip to content

Instantly share code, notes, and snippets.

@mofigan
mofigan / bookmarklet_megalodon.js
Created August 1, 2010 06:48
ウェブ魚拓を見る/取得するブックマークレット
javascript:
(function(){
var l=location.href;
l=prompt('URL',l);
var u='http://megalodon.jp/?url='+escape(l);
with(window.open().document){
location.href=u;
close();
}
}
@diplix
diplix / throttle-plex.sh
Created May 18, 2019 07:30
limit plex media server cpu usage on os x
#!/bin/bash
# limit plex media server cpu usage, especially plex transcoder
# on os x (works on el capitan)
#
# prerequisite: install cpulimit
# brew install cpulimit
#
# arguments:
# -l 100 limits plex cpu usage to around 30-40 % on a mac mini
# running lots of other processen
#!/bin/bash
# ==============================================================
# CPU limit daemon - set PID's max. percentage CPU consumptions
# ==============================================================
# Variables
CPU_LIMIT=20 # Maximum percentage CPU consumption by each PID
DAEMON_INTERVAL=3 # Daemon check interval in seconds
BLACK_PROCESSES_LIST= # Limit only processes defined in this variable. If variable is empty (default) all violating processes are limited.
WHITE_PROCESSES_LIST= # Limit all processes except processes defined in this variable. If variable is empty (default) all violating processes are limited.
@ricardocanelas
ricardocanelas / VagrantFile
Last active September 17, 2020 05:45
Vagrant / PHP7.1 + MySQL5.6 + Apache
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.network "private_network", ip: "192.168.100.100"
config.vm.synced_folder "./www", "/var/www/", :nfs => { :mount_options => ["dmode=777","fmode=666"] }
@afrendeiro
afrendeiro / flac+cue2mp3.sh
Created September 15, 2013 10:39
Command-line conversion of flac+cue files to mp3 split tracks
#!/bin/sh
# Flacon-style convert to mp3 and split tracks from flac+cue files
# Made by André Rendeiro (afrendeiro@gmail.com)
# Rename
{
find . -name '* *' | while read file; do target=`echo "$file" | sed 's/ /_/g'`; mv "$file" "$target"; done
find . -name '* *' | while read file; do target=`echo "$file" | sed 's/ /_/g'`; mv "$file" "$target"; done
find . -name '* *' | while read file; do target=`echo "$file" | sed 's/ /_/g'`; mv "$file" "$target"; done
@t2psyto
t2psyto / translate_srt.py
Created June 3, 2015 15:35
.srt ファイルを日本語翻訳するツール。注意:節度をもって使うこと。google translate にChrome(selenium webdriver)の自動操作でアクセスします。
# -*- coding:utf-8 -*-
from selenium import webdriver
user_agent = (
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) " +
"AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.57 Safari/537.36"
)
sourcedir = "/tmp"
sourcefiles = ["subfile1.srt", "subfile2.srt"]
@yasainet
yasainet / ubuntu_nginx_basic.md
Last active January 21, 2021 03:19
ubuntu nginx basic認証を特定のパスにかける
  1. */etc/nginx/*に移動する
  2. 出力先のディレクトリオーナーがrootになっているのでteeコマンドを使ってリダイレクトする

$ cd /etc/nginx/

$ print "USER:$(openssl passwd -crypt PASSWORD)\n" | sudo tee .htpasswd

  1. .confファイルに.htpasswdへのパスを指定
@stoikheia
stoikheia / cue_to_mp3.py
Last active January 30, 2021 17:24 — forked from bancek/cue_to_mp3.py
CUE splitter using ffmpeg (to mp3)
# -*- encoding: utf-8 -*-
import sys
import os.path
import codecs
if len(sys.argv) == 1:
print "Usage: cue_to_mp3.py <CUE file path> [-o]"
print "Options:"
print " -o, execute and output mp3 file"
@rexlx
rexlx / HOWTO.md
Created August 1, 2020 17:20
TigerVNC on CentOS 8

What has changed

The previous Tigervnc versions had a wrapper script called vncserver which could be run as a user manually to start Xvnc process. The usage was quite simple as you just run

$ vncserver :x [vncserver options] [Xvnc options]

and that was it. While this was working just fine, there were issues when users wanted to start a Tigervnc server using systemd. For these reasons things were completely changed and there is now a new way how this all is supposed to work.

#!/bin/sh
#
# Script to start CPU limit daemon
#
set -e
case "$1" in
start)
if [ $(ps -eo pid,args | gawk '$3=="/usr/bin/cpulimit_daemon.sh" {print $1}' | wc -l) -eq 0 ]; then
nohup /usr/bin/cpulimit_daemon.sh >/dev/null 2>&1 &