Skip to content

Instantly share code, notes, and snippets.

Teruya teru01

Block or report user

Report or block teru01

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View awesome-prompt
git_branch(){
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
export PS1="\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$(git_branch)\$ "
@teru01
teru01 / rust.md
Last active Apr 27, 2019
Rustメモ
View rust.md

これなら問題ない

fn refe(addr: &String) {
    // addr.push('!');
    println!("{}", addr);    
}

fn main() {
    let mut v = "aa".to_string();
View php_image_download_as_binary.php
<?php
$url = "https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
$file = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);
View gist:f474455df07921ca4e374d8e8d88288d
const makeImage = (elFile, file) => {
const elImage = document.createElement('img');
elFile.appendChild(elImage);
const reader = new FileReader();
reader.addEventListener('load', (e) => {
elImage.src = e.target.result;
});
reader.readAsDataURL(file);
};
View fibonacci.c
int fibonacci(int n, int *p){
if(n == 0) {
p[0] = 0;
return p[0];
}else if(n == 1){
p[1] = 1;
return p[1];
}else{
p[n] = fibonacci(n-1, p) + fibonacci(n-2, p);
return p[n];
View server.py
from bottle import Bottle, run, post, request, redirect
import wiringpi as wp
app = Bottle()
state = 0
stdict = {0:"turn off", 1:"turn on"}
wp.wiringPiSetupGpio()
wp.pinMode(2, 1)
@app.route('/')
You can’t perform that action at this time.