Skip to content

Instantly share code, notes, and snippets.

🤔
It's so fun!

Caley Baek jybaek

View GitHub Profile
@jybaek
jybaek / recover.py
Last active Jul 9, 2018
Automatically recover Google account from GCE
View recover.py
#!/usr/bin/env python
#-*- coding: utf-8 -*-
try:
from bs4 import BeautifulSoup
except ImportError:
print("Please install.")
print("pip install bs4.")
exit(255)
View tf_version.py
import tensorflow as tf
if __name__ == '__main__':
print tf.__version__
@jybaek
jybaek / gcp_vision_api_test_code.py
Created Jun 19, 2017
google cloud platform (vision api)
View gcp_vision_api_test_code.py
import io
import os
# export GOOGLE_APPLICATION_CREDENTIALS=/home/oops/github/gcloud/GCP-ML-8492a87b7f32.json
# Imports the Google Cloud client library
from google.cloud import vision
# Instantiates a client
vision_client = vision.Client()
@jybaek
jybaek / bus.php
Last active Mar 21, 2017
경기버스 정보 크롤링
View bus.php
<?php
$url = "http://www.gbis.go.kr/gbis2014/schBusAPI.action";
function curl($data)
{
global $url;
//global $post;
//global $data;
//global $ref_url;
$ch = curl_init();
@jybaek
jybaek / semaphore.c
Created Jun 1, 2016
Example for semaphore in C
View semaphore.c
#include <stdio.h>
#include <pthread.h>
#include <stdlib.h> /* for exit() */
#include <semaphore.h> /* for sem_xxxx() */
sem_t semp;
int val;
static void *wait_fun(void *arg)
{
@jybaek
jybaek / bus_crawler.php
Last active May 25, 2016
실시간 버스 도착 정보 크롤링
View bus_crawler.php
<?php
/* FIXME. change strBusNumber !! */
$url = "http://bus.go.kr/xmlRequest/getStationByUid.jsp?strBusNumber=23248";
$ref_url = "";
$data = array();
function curl($url, $ref_url, $data)
{
$ch = curl_init();
@jybaek
jybaek / print_msg.c
Created May 16, 2016
print debug message in linux system
View print_msg.c
static void printf_msg(const char *fmt, ...)
{
if (fmt == NULL)
return;
va_list ap;
#define CMD_SIZE 512
char tmp_buf[CMD_SIZE];
char cmd[CMD_SIZE+128];
@jybaek
jybaek / .du
Created Feb 26, 2016
Check directory size
View .du
#!/bin/sh
DEPTH=1
if [ "$1" = "-h" ] || [ "$1" = "--help" ] || [ "$1" = "help" ] || [ "$1" = "h" ] ;then
cat <<EOF
======================================================
.du usage : .du {check directory maxdepth} (default 1)
======================================================
@jybaek
jybaek / stackoverflow_QA.sh
Last active Jan 12, 2016
stackoverflow QA
View stackoverflow_QA.sh
cur=$(date +%m) # Need not be described
next6=$(printf %02d $(echo $(($cur+6))%12 | bc))
# 1. $(($cur+6)) is same 'expr' command. result is 7
# 2. echo 7%12 | bc result '7' (remainder)
# 3. printf %02d => 01, 02, 03 ...
# 4. $next6 => current month + 6
# 5. My mistake, if $next6 is 0 => change 1 (if [ $next6 == 0 ];then next6=1;fi)
# 6. END
View string_compare.sh
#!/bin/sh
AA="My name is oops"
BB="name"
if [[ "$AA" == *"name"* ]];then
echo "1st find it"
fi
if [[ "$AA" =~ "name" ]];then
You can’t perform that action at this time.