blog.x-e.ro / code: page 1 of 39
...that's why i wrote sofancy, a fun unicode font tool written in javascript.
usage
ῳɛıཞɖ ųŋıƈơɖɛ ʄƖɛҳıŋɠ? 😜
usage: sofancy [-f (font) | -t | -r] string
flags:
-f|--font (font) : output in a single font
-t|--titles : display titles in output
-r|--random : pick a random font (clobbers -f)
examples:
sofancy -f wide aesthetics
aesthetics
sofancy -t some string | fzf | xsel -i
git commit -m "$(sofancy -tr message | sed 's/^.* /docs: /')"
install
use npm to globally install: npm i -g sofancy
demo
i made a fun web based version as well https://sofancy.0w.nz
for the easy copy pasta ^c^v
sql :: command line database clients
as a curious code monkey, i find myself poking around a lot of different types of databases. and as a terminal junkie, i've used a bunch of different commandline tools to connect and interact with them.
in this post i wanna hightlight the dbcli project. it's a suite of db clients each written in python with a similar interface. clients support autocompletion, syntax highlighting, history, the project is opensource, and cross-platform.
i find myself perpetually using them for postgres, mysql, and sqlite but these have clients for ms-sql, redis, and more....
linux :: running github's open source text editor
update: this post is outdated & atom sux
atom is a "hackable text editor for the 21st century" created by the team at github. it's designed to be customizable, but also usable without needing to edit a config file.
because we spend most of our day in a text editor, the single most important feature we wanted in an editor was extensibility. atom is built with the same open source technologies used by modern web browsers. at the core of atom is chromium, the open source project behind google chrome. with that comes all the power and innovation being developed for the web. but more importantly, extending atom is as simple as writing javascript and css, two languages used by millions of developers each day.
atom.io
linux :: automating tasks in linux
cron jobs are automated scripts that run at a specified date/time, or on a specified interval.
anything that can be executed in the terminal on the server can be run as a cron job (this includes commands, applications, scripts, etc).
crontab is the command used to create/view/modify/remove cron jobs.
- crontab -l lists all scheduled jobs
- crontab -e allows you to edit jobs
- crontab -r will delete *all* your active jobs!
once the crontab file has been edited the cron daemon will automatically read it and update it's job que to match the file. you should see the message:
crontab: installing new crontab
code :: source code management with git
git is a distributed revision control and source code management (SCM) system with an emphasis on speed. git was designed by linus torvalds, of linux fame, for managing the development of the kernel. every git working directory is a fully fledged repository, complete with revision tracking abilities independent of a network or centralized server. git is 100% open-source, freeware, and distributed under the GNU general public license v2.
sql :: quick and dirty sql example
sometimes you find the need to do mass string replacements in your mysql/maria databases. here's how i do it:
UPDATE your_table
SET your_field = REPLACE(your_field, 'old_value', 'new_value')
WHERE your_field LIKE '%old_value%'
sql :: copy and swap database tables in MSSQL
have you ever had a database table that you needed to clone? you can use any number of convoluted methods such as: manually coping and pasting rows in the database manager, running lots of queries/stored procedures, or writing a script to cycle though each row copying data from one table to the next. all of these methods are inferior and far more complex then the method i'm going to show you.
introducing the select into query...
this method should be used if the table you want to clone exists, but the new table douse not. the select into query will create the new table for you, copying all the column names, properties, and data. if you want to make an exact clone of the table you can select * into the new table. but if you only want a few specific columns, you can declare only the ones you want. the syntax is elegantly simple...
SELECT *
INTO [new-table]
FROM [old-table]