Skip to content

Instantly share code, notes, and snippets.

(function () {
$('select[name="count"]').val('100');
$('input[name="retweet"]').attr('checked', false);
$('.action_button_box .btn').first().click();
})();
(function () {
var a = $('.settings_box'), b = $('.editor .contents');
if (a.is(":visible")) {
a.hide();
b.width('1000px');
}
else {
a.show();
(function () {
var a = document.getElementById('choices').getElementsByClassName('action_item');
for (var i = 0, size = a.length; i < size; i ++) {
var e = a[i];
if (! e.classList.contains('selected_item'))
e.click();
}
@masashinakata
masashinakata / extract_ids.js
Last active June 16, 2018 01:59
Extract Twitter ids from selected items in choices pane on Togetter
(function () {
var ids = {};
$('#choices .selected_item .status a').each(function () {
var href = $(this).attr('href');
if (! href)
return;
if (href.match(/https?:\/\/twitter.com\/[^/]+\//))
(function () {
var a = [];
$('#choices .selected_item .status a').each(function () {
var href = $(this).attr('href');
if (! href)
return;
if (! href.match(/https?:\/\/twitter.com\//))
var lis=document.getElementById("results").getElementsByClassName("selected_item"),size=lis.length;
for (var i=size-1;i>=0;i--)
lis[i].getElementsByClassName("icon_delete")[0].click();
// javascript:var%20lis=document.getElementById("results").getElementsByClassName("selected_item"),size=lis.length;for%20(var%20i=size-1;i>=0;i--)%20%20lis[i].getElementsByClassName("icon_delete")[0].click();
@masashinakata
masashinakata / unpack.sh
Last active October 27, 2017 03:58
unpack.sh - Snippet that splits into sample files and answer files.
#!/bin/sh
i=1
bodyname="sample"
test -f "$bodyname$i.txt" && rm -f "$bodyname$i.txt"
test -f "$1" && exec <"$1"
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
@masashinakata
masashinakata / acget.sh
Last active May 2, 2021 06:38
Script that downloads test cases from AtCoder.
#!/bin/sh
FILENAME="$1"
HTML="/tmp/$$.html"
if [ "x$FILENAME" == "x" ]; then
cat > "$HTML"
elif [ -f "$FILENAME" ]; then
cat "$FILENAME" > "$HTML"
@masashinakata
masashinakata / extract.sh
Created June 20, 2017 19:06
Snipet to extract scripts from single Wiki file
#!/bin/sh
i=1
sed -E -n -e '
:loop
/^<(postscript|latex|gnuplot|R)[> ]/ {
N
/<\/(postscript|latex|gnuplot|R)>/!b loop
s/\\/\\\\\\\\/g