Skip to content

Instantly share code, notes, and snippets.

@sekimura
sekimura / deletePosts.js
Last active Nov 22, 2015
delete posts on Facebook profile page
View deletePosts.js
/* 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
*
View memalloc_bench.go
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++ {
View apple-samplecode.bash
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
View blur.cpp
#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 Aug 29, 2015
git-cleanarcpatch.bash
View git-cleanarcpatch.bash
#/bin/bash
# git-cleanarcpatch
# -----------------
#
# Copyright 2014, Masayoshi Sekimura <sekimura@gmail.com>
# Licensed under the MIT license.
#
#
# How to Install:
@sekimura
sekimura / gist:6367366
Last active Apr 14, 2020
phabricator workflow
View gist:6367366
  • 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
View gist:5977057
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
View gist:5825143
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 Jan 31, 2013
swapping Ctrl-Caps keys from terminal
View modifykeys.sh
#!/bin/bash
key="com.apple.keyboard.modifiermapping"
defaults -currentHost delete -g $key
defaults -currentHost write -g $key '(
{
HIDKeyboardModifierMappingDst = 2;
HIDKeyboardModifierMappingSrc = 0;
},
{
View median.py
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:
You can’t perform that action at this time.