This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <tgmath.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
// 20s | |
// Euclidean Algorithm | |
int gcd(int x, int y){ | |
if(y < 1) exit(0); // error | |
int z; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Problem 002 | |
# 0.043[s] | |
# 0, 1, 1, 2, 3, 5, 8, ... | |
def fibo(n) | |
return n if n == 0 || n == 1 | |
x, y, z, i = 1, 1, 1, 2 | |
while i < n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# BB-8 Python driver by Alistair Buxton <[email protected]> | |
from bluepy import btle | |
import time | |
class BB8(btle.DefaultDelegate): | |
def __init__(self, deviceAddress): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Return the degree of similarity (Jaccard Index) for each product | |
* | |
* @param array $mat user-item matrix $mat[product_id][user_id] 1|null | |
* @param integer $product_id | |
* @author Hideaki Kanehara | |
* @return array key: product_id value: degree of similarity | |
*/ | |
function jaccard($mat,$product_id) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(HMM) | |
outputS = c('A', 'B', 'C', 'D', 'E') | |
hiddenS = c('S01', 'S02', 'S13', 'S14', 'S15', 'S56', 'S26', 'S37', 'S48', 'S68', 'E') | |
startP = c(0.10, 0.10, 0.10, 0.10, 0.10, 0.10, 0.10, 0.10, 0.10, 0.10, 0.10) | |
transP = rbind( | |
t(c(0.00, 0.20, 0.20, 0.20, 0.20, 0.00, 0.00, 0.00, 0.00, 0.00, 0.20)), | |
t(c(0.33, 0.00, 0.00, 0.00, 0.00, 0.00, 0.33, 0.00, 0.00, 0.00, 0.34)), | |
t(c(0.20, 0.00, 0.00, 0.20, 0.20, 0.00, 0.00, 0.20, 0.00, 0.00, 0.20)), | |
t(c(0.20, 0.00, 0.20, 0.00, 0.20, 0.00, 0.00, 0.00, 0.20, 0.00, 0.20)), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ls /path/to/src/*.extension | parallel --no-notice mv -fv {} /path/to/dst |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); | |
/* to hide the native tabs */ | |
/* #TabsToolbar { | |
visibility: collapse; | |
} */ | |
/* to hide the sidebar header */ | |
#sidebar-header { | |
visibility: collapse; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -eu | |
# first, get the image URLs using such as Chrome DevTools | |
# The URLs is assumed to be "xxxxx?page={page number}" | |
URI=("https://path/to/file1" "https://path/to/file2") | |
PAGES=(10 20) | |
RED="" | |
GREEN="" | |
BLUE="" | |
NORMAL="" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import wget | |
import requests | |
from bs4 import BeautifulSoup | |
# use Tor | |
local_proxy = 'socks5://127.1:9050' | |
socks_proxy = { | |
'http': local_proxy, | |
'https': local_proxy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -eu | |
# for crontab | |
FILEDIR=/path/to/dir | |
LOGFILE=/var/log/autodel.log | |
DAYS=200 | |
PROCESSES=4 | |
CHUNK=10 | |
# delete files older than 200 days & parallelize |
OlderNewer