Skip to content

Instantly share code, notes, and snippets.

View vu3jej's full-sized avatar
🌴
On vacation

vu3jej

🌴
On vacation
View GitHub Profile
{
"breadcrumbs": [
{
"name": "検索結果 4,000 以上 のうち 1-48件"
},
{
"name": "\"roblox\""
}
],
"products": [
@vu3jej
vu3jej / postgresql.mk
Created July 9, 2020 02:15 — forked from Ignas/postgresql.mk
Set up for a local postgresql database using a Makefile
export PGPORT ?= 4488
PG_PATH ?= $(shell if test -d /usr/lib/postgresql/9.1; then echo /usr/lib/postgresql/9.1; else echo /usr/lib/postgresql/8.4; fi)
PG_DIR = ${PWD}/instance/var
PG_DATA = ${PG_DIR}/data
PG_RUN = ${PG_DIR}/run
PG_LOG = ${PG_DIR}/log
PG_SOCKET = ${PG_RUN}/.s.PGSQL.${PGPORT}
PGPARAMS = -D ${PG_DATA} -o "-F -c unix_socket_directory=${PG_RUN} -c custom_variable_classes='busy' -c busy.active_user=0" -l ${PG_LOG}/pg.log
@vu3jej
vu3jej / waitForKeyElements.js
Created December 23, 2019 13:49 — forked from BrockA/waitForKeyElements.js
A utility function, for Greasemonkey scripts, that detects and handles AJAXed content.
/*--- waitForKeyElements(): A utility function, for Greasemonkey scripts,
that detects and handles AJAXed content.
Usage example:
waitForKeyElements (
"div.comments"
, commentCallbackFunction
);
@vu3jej
vu3jej / _processed_tweets-2017-05-08.ldj
Last active May 8, 2017 07:19
Cleaned tweets -- Japanese-Language Proficiency Test (N5)
{"options": {"A": "ごはん", "C": "やさい", "B": "おにぎり", "D": "くだもの"}, "key": "C. やさい", "stem": "A:「野菜」も食(た)べなさい! B:いや、きらい!"}
{"key": "で", "stem": "すしは、て( )食べるものです。"}
{"options": {"A": "せんせ", "C": "せっせん", "B": "そんせん", "D": "せんせい"}, "key": "D. せんせい", "stem": "「先生」はどこにいますか?"}
{"options": {"A": "ゆうびんきょく", "C": "としょしつ", "B": "ぎんこう", "D": "ほうどうきょく"}, "key": "A. ゆうびんきょく", "stem": "「郵便局」できってを買(か)います。"}
{"key": "を", "stem": "すみません。でんわばんごう( )まちがえました。"}
{"options": {"A": "鋭ぎ", "C": "脱ぎ", "B": "税ぎ", "D": "脂ぎ"}, "key": "C. 脱ぎ", "stem": "靴を「ぬぎ」なさい。"}
{"options": {"A": "の,で", "C": "の,に", "B": "と,で", "D": "と,に"}, "key": "D. と,に", "stem": "きょうしつは一かい( )二かい( )あります。"}
{"options": {"A": "くつ", "C": "かばん", "B": "あし", "D": "ずぼん"}, "key": "A. くつ", "stem": "「靴」をはきます。"}
{"options": {"A": "から", "C": "だけ", "B": "に", "D": "が"}, "key": "A. から", "stem": "じゅぎょうは10じ( )です。"}
{"options": {"A": "より", "C": "しか", "B": "は", "D": "ぐらい"}, "key": "A. より", "stem": "ラーメン( )ごはんのほうがすきです。"}
@vu3jej
vu3jej / classify.py
Created May 4, 2017 05:31 — forked from bwbaugh/classify.py
Detecting a Specific Watermark in a Photo with Python Get example training and testing images here: <http://bwbaugh.com/stack-overflow/16222178_watermark.tar> Stack Overflow question: <http://stackoverflow.com/questions/16222178/detecting-a-specific-watermark-in-a-photo-with-python-without-scipy>
# Copyright (C) 2013 Wesley Baugh
"""Tools for text classification.
Extracted from the [infer](https://github.com/bwbaugh/infer) library.
"""
from __future__ import division
import math
from collections import defaultdict, namedtuple, Counter
from fractions import Fraction
@vu3jej
vu3jej / colour_extractor.py
Last active March 29, 2023 23:55
COLOUR NAME EXTRACTION USING SPACY
import spacy
class ColourExtractorStrict:
"""Extract colours along with adjectives"""
def __init__(self, colours):
self.colours = colours
self.pos_ok = ['ADJ', 'NOUN']
self.tagger = spacy.load('en')
@vu3jej
vu3jej / slytherin.py
Created September 21, 2016 15:23
camelCase ==> snake_case
def slytherin(string):
"""Convert & return strings in camelCase to snake_case"""
tmp = re.sub(pattern=r'(.)([A-Z][a-z]+)', repl=r'\1_\2', string=string)
return re.sub(pattern=r'([a-z0-9])([A-Z])', repl=r'\1_\2', string=tmp)\
.lower()
@vu3jej
vu3jej / print_zip_file_count.sh
Last active August 4, 2016 12:37
Bash one-liner to print the filename, compressed size, compression factor and ZIP archive name of all the zipped files in a directory
for file in $(find . -type f -print); do zipinfo -m "$file" | awk -v filename="$file" -F ' ' '{ print $4, "\t", $6, "\t", $10, "\t", filename }'; done;
@vu3jej
vu3jej / print_immediate_parent_dir.sh
Created August 4, 2016 08:05
Print immediate parent directory along with filename and the file size
#!/bin/bash
for filename in $(find . -type f -print)
do
du_out=$(du -s $filename)
splitted=($(echo ${du_out}))
size="${splitted[0]}"
abs_path="${splitted[1]}"
parent_dir=$(basename $(dirname "$abs_path"))
filename=$(basename "$abs_path")
@vu3jej
vu3jej / print_size_absolute_path.sh
Created August 4, 2016 06:50
Bash one-liner to print the size and absolute path of the files recursively
for filename in $(find . -type f -print); do du -s "$filename"; done