Skip to content

Instantly share code, notes, and snippets.

@syohex
syohex / neon_test.c
Created June 30, 2012 13:10
sample code of generation ARM NEON instruction
/*
arm-linux-gnueabi-gcc-4.6 -O2 -march=armv7-a -mtune=cortex-a9 -ftree-vectorize -mhard-float -mfloat-abi=softfp -mfpu=neon -ffast-math -mvectorize-with-neon-quad -S neon_test.c
*/
void NeonTest(short int * __restrict a, short int * __restrict b, short int * __restrict z)
{
int i;
for (i = 0; i < 200; i++) {
z[i] = a[i] * b[i];
}
}
@syohex
syohex / cperl-imenu.el
Created November 8, 2012 09:25
my own perl imenu. Default imenu provides too many information for me
(defun my/cperl-imenu-create-index ()
(let (index)
;; collect subroutine
(goto-char (point-min))
(while (re-search-forward "^\\s-*sub\\s-+\\([^ ]+\\)" nil t)
(push (cons (format "Function: %s" (match-string 1))
(match-beginning 1)) index))
;; collect subtest
(goto-char (point-min))
@syohex
syohex / parse-csv.el
Created April 30, 2013 09:49
very simple csv parser in emacs lisp
(require 'cl)
(defun parse-csv-file (file)
(interactive
(list (read-file-name "CSV file: ")))
(let ((buf (find-file-noselect file))
(result nil))
(with-current-buffer buf
(goto-char (point-min))
(while (not (eobp))
@syohex
syohex / qrencode-encode-sample.c
Created February 16, 2016 03:59
Sample code of libqrencode
#include <qrencode.h>
#include <stdio.h>
#include <stdlib.h>
static const size_t ZOOM_SIZE = 10;
int main(int argc, char *argv[])
{
if (argc < 2) {
fprintf(stderr, "Usage: %s string\n", argv[0]);
@syohex
syohex / Screenshot_20210928-100031.png
Last active September 28, 2021 01:09
feedback to LingoChampApp
Screenshot_20210928-100031.png
@syohex
syohex / update-gh.sh
Created July 22, 2021 01:27
update gh script on Linux environment
#!/usr/bin/env bash
set -e
set -x
VERSION=$1
if [[ $VERSION == "" ]]; then
echo "Usage: update-gh version"
exit 1
fi
@syohex
syohex / _cpanm
Created July 9, 2013 09:01
cpanm zsh completion support new comman line option
#compdef cpanm
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for cpanm (http://search.cpan.org/dist/App-cpanminus/lib/App/cpanminus.pm).
#
# Source: https://github.com/rshhh/cpanminus/blob/master/etc/_cpanm
#
# ------------------------------------------------------------------------------
@syohex
syohex / json2gostruct.py
Created May 30, 2016 11:43
Convert from JSON to Golang struct definition in Python
#!/usr/bin/env python
import sys
import os
import json
def usage():
print("Usage: json2gostruct.py struct_name")
os.exit(0)
def indent(nest):
@syohex
syohex / sample.md
Last active December 6, 2020 02:26
test for code block with list
  1. #!/usr/bin/env ruby
    print "hello world"
  2. This is normal text
@syohex
syohex / udev_test.c
Created September 5, 2013 04:36
libudev test program
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stddef.h>
#include <errno.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdbool.h>