Posts

Showing posts from May, 2019

Output File from PSQL Command

Image
She had an immense curiosity about life, and was constantly staring and wondering. — Henry James in The Portrait of a Lady. Hi guys, if one day your on a vacation on a remote island and can’t access your workstation. And the only access you can get due to slow internet speed is SSH (Secure Shell). You tried to access the remote production database using a rented computer and an SSH client, the tools inside the server is only compose of a psql command. Don’t panic and don’t worry we got you covered, the psql saves your day if you’ll just gonna be exporting SQL schema layouts. First and foremost, we fire up and execute the psql command. Inside the psql environment execute the commands below: \o dump.txt SELECT 'postgresql' AS dbms,t.table_catalog,t.table_schema,t.table_name,c.column_name,c.ordinal_position,c.data_type,c.character_maximum_length,n.constraint_type,k2.table_schema,k2.table_name,k2.column_name FROM information_schema.tables t NATURAL LEFT JOIN i

C# .NET Projects Can Be Compiled and Run in MacOS or Linux

Image
My primary goal of hacking was the intellectual curiosity, the seduction of adventure. — Kevin Mitnick. Hi guys, before I never thought that a .NET solution project can be compiled and run on Linux. But as I’ve checked the GitHub of dotnet-core , there are many ways to do it. First is through Mono , which is a compatible open source alternative to the .NET Framework (the latter is a proprietary of Microsoft). You can create WPF (Windows Presentation Foundation) forms using it and other UI intensive .NET projects. Mono is sponsored by Microsoft, but it is unofficially supported. The other solution is, if your working on a .NET core project you’ll be using a dotnet-core . Microsoft published last 2014 an open source .NET SDK (Software Development Kit) (bare bones) which was derived from ASP.NET , they’ve called it dotnet-core . Basically, it is a stripped down version of .NET framework without all the heavy UI and forms. The project itself is modular and can be compiled in

Check Total File Size of Files with Specific File Extension

Image
It is simply this: do not tire, never lose interest, never grow indifferent—lose your invaluable curiosity and you let yourself die. It's as simple as that. — Tove Jansson in Fair Play. Hi guys, I’ve recently wondered on how to check the file size of all files with a specific file extension on a folder / project. This is what I’ve found out after several experimentation using command line tools in Linux, this specific task could be accomplish with just one line of command. Check below for the actual command: find . -name "*.dart" | xargs cat | wc -c What this command does, is first find all file with the dart extension. Then pipe the output of that command in xargs converts the standard input to command arguments. After that pipe the output of xargs again to our favorite word counter wc . Here are the command line tools use in the process. xargs is a command on Unix and most Unix-like operating systems used to build and execute commands from stan

Learning Git Shortcuts By Examples

Image
Together we can change the world, just one random act of kindness at a time. — Ron Hall. Hi guys, I’ve been wondering before on how to create aliases in git (a version control system) but after reading and delving more into some documents. I found out that this is possible and can be done with a few global configs. Check out the commands below for some sample. git config --global alias.co checkout git config --global alias.br branch git config --global alias.ci commit git config --global alias.st status This commands will emulate an SVN (subversion) like keywords and can be called on command line like git ci to commit your changes. Additionally, here are some useful aliases that I’ve found while exploring the internet. git config --global alias.hist "log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short" git config --global alias.type 'cat-file -t' git config --global alias.dump 'cat-file -p' To conclude there are man