Skip to content

Instantly share code, notes, and snippets.

@coord-e
coord-e / safemode.xm
Last active November 30, 2023 22:11
auto safemode
#define time 3600 //一時間
%hook SpringBoard
-(void)applicationDidFinishLaunching: (id)application {
%orig;
[[NSOperationQueue new] addOperationWithBlock:^{
[[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:time]];
NSString* string = @[@"Crash"][2];
}];
git-add-untracked () {
FILES=$(git ls-files --others --exclude-standard $1)
echo $FILES | sed '/^$/d'
echo "Adding $(echo ${FILES:+$FILES" "} | grep -o " " | grep -c ^ | sed '/^$/d') files"
echo $FILES | xargs git add
}
@coord-e
coord-e / lldecl.sh
Last active August 21, 2017 14:36
Extract llvm function declarations from c header
#!/bin/bash
# EXAMPLE: ./lldecl.sh /usr/include/stdio.h
INFILE=$1
TMPFILE1=$(mktemp)".h"
TMPFILE2=$(mktemp)".c"
clang -E $INFILE -o $TMPFILE1
echo '#include "'$TMPFILE1'"' >> $TMPFILE2
@coord-e
coord-e / octocat.cpp
Last active December 19, 2017 12:42
cart cart.cpp octocat.png -r 7 -c 3 -d > octocat.cpp
#include<iostream>
#include<numeric>
#include<algorithm>
#include<sstream>
#include<opencv2/opencv.hpp>
#include<opencv2/core/core.hpp>
#include<opencv2/highgui/highgui.hpp>
#include<args.hxx>
#include<clang-c/Index.h>
#define ch ArgumentParser
@coord-e
coord-e / Dman.cpp
Last active December 19, 2017 12:41
cart cart.cpp Dman.png -r 3 -c 1 -d > Dman.cpp
#include<iostream>
#include<numeric>
#include<algorithm>
#include<sstream>
#include<opencv2/opencv.hpp>
#include<opencv2/core/core.hpp>
#include<opencv2/highgui/highgui.hpp>
#include<args.hxx>
#include<clang-c/Index.h>
#define ch ArgumentParser
@coord-e
coord-e / pika.cpp
Last active December 19, 2017 12:40
cart cart.cpp pikachu.png -r 2 -c 1 -d > pika.cpp
#include<iostream>
#include<numeric>
#include<algorithm>
#include<sstream>
#include<opencv2/opencv.hpp>
#include<opencv2/core/core.hpp>
#include<opencv2/highgui/highgui.hpp>
#include<args.hxx>
#include<clang-c/Index.h>
#define ch ArgumentParser
@coord-e
coord-e / streaming.js
Created January 10, 2018 15:10
Google Speech API Streaming Node.js Working Example
const record = require('node-record-lpcm16');
// Imports the Google Cloud client library
const Speech = require('@google-cloud/speech');
// Your Google Cloud Platform project ID
const projectId = 'projectId';
// // Creates a client
const speech = new Speech.SpeechClient({
projectId: projectId,
#!/bin/bash
# Copyright © 2018 coord.e
# This work is free. You can redistribute it and/or modify it under the
# terms of the Do What The Fuck You Want To Public License, Version 2,
# as published by Sam Hocevar. See the COPYING file for more details.
ITERATION_NUM=20
CANDIDATES=("ifconfig.me" "icanhazip.com" "ipinfo.io/ip" "checkip.amazonaws.com" "inet-ip.info" "httpbin.org/ip" "ifconfig.co")
declare -A RESULTS
@coord-e
coord-e / le.sh
Last active August 16, 2018 06:11
Log the command's stdout&stderr to $ERRLOGPATH if failed. e.g. _le clang a.cpp
function _le {
# Usage: _le command
local file=$(mktemp)
# Run the supplied command in screen, and print the exit code on exit
local screen_cmd='trap '"'"'echo -en "\n"$?'"'"' EXIT; '$@
screen -Logfile $file -L bash -c "$screen_cmd"
# Overwrite "screen is terminating" message with empty
@coord-e
coord-e / livr.md
Last active August 27, 2018 13:04
速いWeb(に限らず、インタラクティブなフォーマット)を作ろうとしたアイデア

The Lightweight Interactive View Representation

(pronounced as 'liver'!?)

Fast to show, in every platform.

Use cases

  • Browser Rendering daemon which produces Livr from html