This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <cstdio> | |
| #include <cstring> | |
| int main() | |
| { | |
| FILE* const sudo = popen("sudo -H -s", "r+"); | |
| fprintf(sudo, "echo login_test\n"); | |
| fflush(sudo); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/ruby | |
| require 'nokogiri' | |
| ioreg = IO::popen("ioreg -a -c AppleSmartBattery", "r") | |
| doc = Nokogiri::XML(ioreg) | |
| ioreg.close | |
| cc=doc.xpath("//key[text()=\"CurrentCapacity\"]")[0] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/ruby | |
| require 'optparse' | |
| Signal::trap("INT") do |signo| | |
| exit | |
| end | |
| opt = OptionParser.new |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| set log x | |
| set key left top | |
| # set term wxt | |
| set format x "10^{%L}" | |
| set term png enhanced size 1280,960 lw 2 fontscale 3 | |
| set term eps enhanced lw 1.5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <cstdio> | |
| #include <cstdlib> | |
| #include <vector> | |
| #include <sys/time.h> | |
| #include <algorithm> | |
| #include <numeric> | |
| double get_time_now() | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| TIME_BEGIN=$(date +%s) | |
| TIME_NOW="$TIME_BEGIN" | |
| TIME_END=$(date -d "$1" +%s) | |
| TIME_LEFT=$(expr "$TIME_END" - "$TIME_NOW") | |
| while [ ${TIME_LEFT} -gt 0 ] | |
| do | |
| echo ${TIME_LEFT}s left |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/ruby | |
| input="input" | |
| $log=File::open("log.txt", "w") | |
| def do_enc(input, start_at, stop_at, output) | |
| command = "HandBrakeCLI -Z \"Android Tablet\" -e x264 -q 25.0 --x264-preset medium -E faac -i \"%s\" --main-feature -a 1 --subtitle-burned 1 -O -m --start-at duration:%s --stop-at duration:%s --decomb bob -o %s" % [input, start_at, stop_at, output] | |
| $stderr.puts "----------------------------------" | |
| $stderr.puts command |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/ruby | |
| # coding: utf-8 | |
| require 'open3' | |
| Open3.popen3('gnuplot') do |gp_in, gp_out, gp_err| | |
| gp_in.puts "set term png" | |
| gp_in.puts "set output \"| ffmpeg -y -f image2pipe -i - -vcodec copy out.mp4 >ffmpeg.log 2>&1" | |
| 500.times do |i| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (require 'tramp) | |
| (setq tramp-default-method "scp") | |
| (setq tramp-ssh-controlmaster-options | |
| (concat "-o ControlPath=" (getenv "HOME") "/.ssh/master-%%r@%%h:%%p") | |
| ) | |
| (setq tramp-debug-buffer t) | |
| (setq tramp-verbose 10) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/ruby | |
| IO.popen("port -q installed", "r") do |port| | |
| while line = port.gets | |
| md_active = line.match(/\(active\)/) | |
| is_active = md_active | |
| if is_active | |