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 bash | |
# Place where I manipulate files when I an studying my Anki cards | |
# and need to run quick snippets of code to assert my knowledge of | |
# the things I am committing to the long-term memory. | |
temp_study_dir="${HOME}/Public/tempstudyfiles" | |
if [ ! -d "$temp_study_dir" ] ; then | |
mkdir --parent "$temp_study_dir" | |
cd "$temp_study_dir" |
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
INSERT INTO images ( | |
post_id | |
, extension | |
, position | |
, created_at) | |
(SELECT | |
'13' | |
, 'jpg' | |
, COALESCE(MAX(position), 0) + 1 | |
, CURRENT_TIMESTAMP |
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 bash | |
usage() { | |
printf "\nUsage: ${0##*/} path session\n\n" | |
printf " path: a path like \`~/projs/foo\`\n" | |
printf " session: a name for the session tmux will create\n" | |
} | |
if (($# < 2)); then | |
usage | |
exit 1 |
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/bash | |
find ./ -name '*.php' -o -name '*.html' -o -name '*.css' -o -name '*.js' -type f | | |
while read file | |
do | |
echo " $file" | |
mv $file $file.icv | |
iconv -f ISO-8859-1 -t UTF-8 $file.icv > $file | |
rm -f $file.icv | |
done |
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
// https://www.codingame.com/training/easy/temperatures | |
// gcc -std=c99 -Wall -pedantic -o temperatures temperatures.c | |
// ./temperatures <<< $(cat input.txt) | |
// | |
// input.txt | |
// 9 | |
// 7 22 -99 0 -1 35 -2 +7654 21 | |
#include <stdio.h> | |
#include <stdlib.h> |
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
| Date | Time Studied | | |
|------------------+--------------| | |
| <2016-11-22 Tue> | 02:30 | | |
| <2016-11-23 Wed> | 01:00 | | |
| <2016-11-25 Fri> | 02:00 | | |
| <2016-11-30 Wed> | 02:00 | | |
| | | | |
| | | | |
| | | | |
| ... | | |
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
// Exercise 1-20. Write a program detab that replaces tabs in the input with | |
// the proper number of blanks to space to the next tab stop. Assume a fixed | |
// set of tab stops, say every n columns. Should n be a variable or a symbolic | |
// parameter? | |
// $ gcc -std=c99 -Wall -pedantic -L./lib -o devel devel.c -lmyline | |
// $ LD_LIBRARY_PATH=./lib ./devel <<< $'Li\tnu\tx\t\t!' | |
// len 39, line Li--------nu--------x----------------! |
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
// Exercise 1-23. Write a program to remove all comments from a C program. | |
// Don't forget to handle quoted strings and character constants properly. C | |
// comments don't nest. | |
#include <stdio.h> // Includes the standard INPUT/OUTPUT library. | |
#include "lib/helpers.h" /* Includes our own helper functions. */ | |
int main(void) | |
{ | |
printf(/* cmt1 */"%d" /* cmt2 */ "\n", 10); /* |
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
#lang htdp/bsl | |
; | |
; Invariants | |
; ---------- | |
; at each level: | |
; - all accounts in left sub-tree have account number | |
; less than root; | |
; - all accounts in right sub-tree have account number | |
; greater than root; |
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
DESCRIBE categorias; | |
SELECT CONCAT ( | |
t1.nome | |
, IFNULL (CONCAT (' → ', t2.nome), '') | |
, IFNULL (CONCAT (' → ', t3.nome), '') | |
, IFNULL (CONCAT (' → ', t4.nome), '') | |
) AS fullpath | |
FROM categorias AS t1 | |
LEFT JOIN categorias AS t2 ON t2.parent_id = t1.id |