Skip to content

Instantly share code, notes, and snippets.

@madeingnecca
madeingnecca / gist:4160553
Last active July 14, 2017 00:48
BASH utils
#!/bin/bash
# Cleans directory from cvs dir/files.
# http://snippets.dzone.com/posts/show/934
find "$1" -name 'CVS' -exec rm -rf '{}' \; -print
# Generate fake file with a specific size (useful for uploads)
head -c 3000000 /dev/urandom > upload_test_3MB.zip
# Extracts count per page name in an access_log Apache file
@mikeschinkel
mikeschinkel / virtual-posts.php
Last active December 11, 2017 21:49
Proof of concept showing how to implement virtual posts in WordPress but requires `make_post_instance` hook (or similar) to exist. See: https://core.trac.wordpress.org/ticket/12955#comment:24
<?php
/**
* Plugin Name: Virtual Posts
*
* @see https://github.com/usagov/Federal-Agency-Directory-API-Documentation
*/
class Virtual_Posts {
const POST_TYPE = 'vp_fed_mob_apps';
@itzikbenh
itzikbenh / db-class.php
Last active October 5, 2016 22:23
Simple WordPress query builder. In progress.
<?php
class Ath_DB
{
protected static $table = null;
function __construct()
{
global $wpdb;
$this->db = $wpdb;
@mjdietzx
mjdietzx / waya-dl-setup.sh
Last active March 13, 2024 15:08
Install CUDA Toolkit v8.0 and cuDNN v6.0 on Ubuntu 16.04
#!/bin/bash
# install CUDA Toolkit v8.0
# instructions from https://developer.nvidia.com/cuda-downloads (linux -> x86_64 -> Ubuntu -> 16.04 -> deb (network))
CUDA_REPO_PKG="cuda-repo-ubuntu1604_8.0.61-1_amd64.deb"
wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/${CUDA_REPO_PKG}
sudo dpkg -i ${CUDA_REPO_PKG}
sudo apt-get update
sudo apt-get -y install cuda
@mulderu
mulderu / bash-file-read-and-work.sh
Last active May 15, 2018 04:41
bash, file read, loop, work
#!/bin/bash
k=1
input="t1"
while IFS= read -r var
do
echo "$k ]"
echo "$var"
cat "$var"
wc -l "$var"
@mulderu
mulderu / bash-util-01.sh
Last active July 17, 2018 03:13
bash util
# locale setup
sudo locale-gen "en_US.UTF-8"
sudo locale-gen "ko_KR.UTF-8"
#.bashrc
export LANG="ko_KR.UTF-8"
export LC_ALL="ko_KR.UTF-8"
# multiple fname pattern find
find /home/mulder/Downloads/phone_0 -name "*.jpg" -o -name "*.png"
@mulderu
mulderu / ssh-reverse-ssh.sh
Created August 31, 2017 07:15
reverse ssh, ssh forwarding
# reverse ssh tunneling
# simple way
# ref from : https://www.howtoforge.com/reverse-ssh-tunneling
#
# env-summary
# target : 192.168.5.10 (internal ip in firewall)
# ssh-gateway : 100.100.100.10 (static ip in public access)
#
# step 1) login to ssh-gateway from target(target is your final destination)
ssh -R 19999:localhost:22 mulder@100.100.100.10
@mulderu
mulderu / python_pil_demo_study.py
Created November 23, 2017 04:28
python, pillow, pil, image processing demo
import os
import numpy as np
import cv2
from PIL import Image
from PIL import ImageDraw
from PIL import ImageFilter
'''
ref : http://pillow.readthedocs.io/en/3.4.x/index.html
ref : basic : https://www.youtube.com/watch?v=Fd_0ns8bmCY
@mulderu
mulderu / vim_key_info.txt
Last active December 13, 2017 20:58
vim and cmd util space 4 or space 2 and line number and special chars
vim
$ cat .vimrc
--------------------
filetype plugin indent on
" show existing tab with 4 spaces width
set tabstop=2
" when indenting with '>', use 4 spaces width
set shiftwidth=2
" On pressing tab, insert 4 spaces
@mulderu
mulderu / mysetup.md
Last active July 14, 2018 04:59
mysetup, vscode, vim, bash, and more

httpd.conf

allow show directory index

<IfModule alias_module>
    ...
    Alias /Project /Users/mulder/Project
</IfModule>
<Directory "/Users/mulder/Project">
 AllowOverride None