Skip to content

Instantly share code, notes, and snippets.

" vim-plugでPluginがインストールされているかどうかを判定する
function s:has_plugged(name)
if exists('g:plugs') && has_key(g:plugs, a:name) && isdirectory(g:plugs[a:name].dir)
return 1
else
return 0
endif
endfunction
/**
* continuous dump from binary stream
* $ tail -f xxx | xstream
*/
#include <stdio.h>
#include <stdint.h>
void xstreamer(FILE *fdin, FILE *fdout) {
int col = 0;
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
static int ng_count = 0;
#define TEST_EQUAL(expect, v) do { if ((v) != (expect)) { \
printf("Failed @__%d__: v=%02x expect=%02x", __LINE__, (v), (expect)); \
printf("\n v:"); \
DEC2BIN((v)); \
printf("\n e:"); \
@ryochack
ryochack / echo.rs
Last active December 28, 2016 06:39
// 標準入力を受け取って標準出力に吐き出す
use std::io::{self, Read, Write};
fn main() {
const N: usize = 8;
let mut buf = [0u8; N];
loop {
match io::stdin().read(&mut buf) {
Ok(s) => {
if s == 0 {
/**
* Calculate Base64 encoded size
**/
#include <stdio.h>
#include <stdlib.h>
uint32_t calc_base64_size(uint32_t size)
{
uint32_t bit_size = size * 8;
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <errno.h>
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdlib.h>
/**
package main
import (
"fmt"
"os"
)
func main() {
buf := make([]byte, 0x10)
offset := 0x00000000
@ryochack
ryochack / .gitignore
Last active December 26, 2015 08:45
PSoC用の.gitignore
.DS_Store
*~
*.hex
*.bak
GPATH
GRTAGS
GTAGS
tags
doxygen/
*.zip
#!/usr/bin/ruby
require "FileUtils"
def is_asm?(str)
return true if str =~ /\.s\b/i
return true if str =~ /\.asm\b/i
return false
end
package main
type container struct {
v [64]byte
}
func MakeContainer() *container {
c := container{}
return &c
}