Skip to content

Instantly share code, notes, and snippets.

@sekimura
sekimura / deletePosts.js
Last active November 22, 2015 23:37
delete posts on Facebook profile page
/* After deactivating some Apps (eg Twitter, Yahoo Flickr etc), I noticed that I could not remove posts via GraphAPI
* because it would be a defferent app from the app originaly posted statuses.
* There might be a better to do it via offical APIs, but I was lazy and inspected some html class names to click
* around on my profile page and delete posts.
*
* Usage:
* 1. Go to your profile page and open Web Inspector Console (I used Google Chrome)
* 2. Copy and paste the script below to the console
* 3. Ovserve how it's deleting your posts or just open another tag to go somewhere else
*
package bench_test
import "testing"
func BenchmarkMemAllocOndemand(b *testing.B) {
n := 10
b.ResetTimer()
for i := 0; i < b.N; i++ {
s := make([]string, 0)
for j := 0; j < n; j++ {
curl https://developer.apple.com/library/mac/navigation/library.json | grep samplecode | awk -F/ '{print "https://developer.apple.com/library/mac/samplecode/"$3"/"$3".zip"}' | parallel curl -O
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
int
main(int argc, char *argv[])
{
cv::Mat src_img = cv::imread("./960x460.jpg", 1);
if(!src_img.data) return -1;
@sekimura
sekimura / git-cleanarcpatch.bash
Last active August 29, 2015 14:02
git-cleanarcpatch.bash
#/bin/bash
# git-cleanarcpatch
# -----------------
#
# Copyright 2014, Masayoshi Sekimura <[email protected]>
# Licensed under the MIT license.
#
#
# How to Install:
@sekimura
sekimura / gist:6367366
Last active December 10, 2021 16:56
phabricator workflow
  • create tasks T{NNNN} asign them
  • create a branch with name like "T{NNNN}-boo-hoo"
  • git checkout -b T1234-boo-foo
  • commit changes on that branch until it gets ready to be reviewed
  • git commit -am 'first'
  • git commit -am 'now it works'
  • check if it's lint free (NOTE: it runs lint against only modified files)
  • arc lint
  • push a review request to the server. This will create a diff with id D{NNNN}
  • arc diff
Domain ID:D98203603-LROR
Domain Name:QOOTAS.ORG
Created On:27-May-2003 21:47:18 UTC
Last Updated On:01-Dec-2009 21:52:03 UTC
Expiration Date:27-May-2013 21:47:18 UTC
Sponsoring Registrar:Wild West Domains, LLC (R120-LROR)
Status:CLIENT DELETE PROHIBITED
Status:CLIENT RENEW PROHIBITED
Status:CLIENT TRANSFER PROHIBITED
Status:CLIENT UPDATE PROHIBITED
import sys
import urllib2
import xml.etree.ElementTree as ET
PING_URL = 'http://www.google.com/webmasters/tools/ping?sitemap=%s'
def fetch_sitemaps(sitemapindex):
response = urllib2.urlopen(sitemapindex)
xml = response.read()
@sekimura
sekimura / modifykeys.sh
Created January 31, 2013 20:26
swapping Ctrl-Caps keys from terminal
#!/bin/bash
key="com.apple.keyboard.modifiermapping"
defaults -currentHost delete -g $key
defaults -currentHost write -g $key '(
{
HIDKeyboardModifierMappingDst = 2;
HIDKeyboardModifierMappingSrc = 0;
},
{
def partition(data, lo, hi):
pivot = data[lo]
print 'part', lo, hi, pivot
i, j = lo + 1, hi - 1
while True:
while data[i] <= pivot:
i = i + 1
if i == hi:
break
while data[j] > pivot: