Skip to content

Instantly share code, notes, and snippets.

@2jiwon
2jiwon / argv_stack.c
Created February 12, 2018 08:56
Take command-line arguments and make them reverse output
#include <stdio.h>
int
main (int argc,
char* argv[])
{
int num;
if (argc >= 1)
num = argc;
@2jiwon
2jiwon / detect_hyphen1.c
Last active April 12, 2018 13:56
Take arguments and output whether it contains hyphen or not, and so on...
/* Take arguments and output whether it contains hyphen or not. */
#include <stdio.h>
int
main (int argc,
char* argv[])
{
int num;
if (argc >= 1)
num = argc;
@2jiwon
2jiwon / optional_output.c
Last active April 12, 2018 13:57
Take arguments and output them as if '-e' & '-c' options.
#include <stdio.h>
#include <stdlib.h>
int
main (int argc,
char* argv[])
{
int num;
if (argc >= 1)
num = argc;
@2jiwon
2jiwon / rename_files.sh
Last active April 12, 2018 13:54
A Bash Shell Script to find ".aaa" files recursively in a directory, then rename the files as ".bbb".
#!/bin/bash
num = 0
for file in $(find ./* -name '*.sgk' | grep -n 'sgk$')
do
(( num++ ))
echo "$file"
done
echo -e '\n' "Searched $num files.\n"
@2jiwon
2jiwon / replace_in_files.sh
Created March 6, 2018 17:02
A Bash Shell Script to replace a string in files of a directory recursively.
#!/bin/bash
Files=(`grep -r "\.sgk" ./ | cut -d: -f1 | uniq`)
for file in "${Files[@]}"
do
echo "Filename: $file"
grep "\.sgk" "$file" | more
done
echo ""
@2jiwon
2jiwon / background-generator.markdown
Created April 7, 2018 11:24
Background Generator