Skip to content

Instantly share code, notes, and snippets.

View nkostic's full-sized avatar

Nenad Kostic nkostic

View GitHub Profile
@nkostic
nkostic / cloudSettings
Created April 26, 2022 18:56
Visual Studio Code Settings Sync Gist
{"lastUpload":"2022-04-26T18:56:34.953Z","extensionVersion":"v3.4.3"}
@nkostic
nkostic / terminal_commands.md
Created May 26, 2020 22:43
Useful linux terminal commands

Duplicate Files:

for i in {1..100}; do cp test.ogg "test_$i.ogg" ; done

How Many Files in Folder:

find . -type f | wc -l
@nkostic
nkostic / debug_log.php
Created December 31, 2017 00:39
tail -f debug.log to read the log from terminal
/**
* php line debug
*/
function debug_log($data) {
$filename = realpath(__DIR__ . './debug.log');
if (!file_exists($filename) || !is_writable($filename)) {
return;
}
file_put_contents($filename, sprintf("[%s] %s \n",
@nkostic
nkostic / sakomoto_day_of_the_week.java
Created August 8, 2016 06:51
Tomohiko Sakamoto's Algorithm
int dow(int y, int m, int d) {
static int t[] = {0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4};
y -= m < 3;
return (y + y/4 - y/100 + y/400 + t[m-1] + d) % 7;
}
@nkostic
nkostic / dateformating
Created March 22, 2014 06:10
Formating Date And Time
SELECT convert(varchar, getdate(), 100) -- mon dd yyyy hh:mmAM (or PM)
-- Oct 2 2008 11:01AM
SELECT convert(varchar, getdate(), 101) -- mm/dd/yyyy - 10/02/2008
SELECT convert(varchar, getdate(), 102) -- yyyy.mm.dd – 2008.10.02
SELECT convert(varchar, getdate(), 103) -- dd/mm/yyyy
SELECT convert(varchar, getdate(), 104) -- dd.mm.yyyy
SELECT convert(varchar, getdate(), 105) -- dd-mm-yyyy
SELECT convert(varchar, getdate(), 106) -- dd mon yyyy
SELECT convert(varchar, getdate(), 107) -- mon dd, yyyy
SELECT convert(varchar, getdate(), 108) -- hh:mm:ss
@nkostic
nkostic / badadobefont.cfm
Created March 11, 2014 05:05
Figure out which font needs to be removes/reinstalled.
<cfset fontobj = createobject("java","com.adobe.fontengine.fontmanagement.FontLoader")>
<cfdirectory action="list" directory="c:\windows\fonts" name="fontdir">
<table border="1" style="border-collapse:collapse">
<tr>
<th>Font Name:</th>
<th>Error</th>
</tr>
<cfloop query="fontdir">
<cftry>
<cfset loaded = fontobj.load(createobject("java","java.net.URL").init("file:///C|/windows/fonts/#fontdir.name#"))>
{
occupation : "software developer"
,field : "web"
,passion : ["coding","web","technology","music"]
,hobies : ["music production","deejaying"]
,sports : ["tennis","bicycling","skiing","swimming"]
}
<snippet>
<content>
<![CDATA[
<cfcomponent
displayname="${1:newComponent}"
output="true"
hint="">
<cffunction
@nkostic
nkostic / cfcapp.sublime-snippet
Created January 31, 2014 03:27
application.cfc snippet
<snippet>
<content>
<![CDATA[
<cfcomponent
displayname="Application"
output="true"
hint="Handle the application.">
@nkostic
nkostic / mssql_db_backup.bat
Created November 29, 2012 00:30
MSSQL Database Insatance Backup BAT part
ECHO OFF
CLS
:MENU
ECHO.
ECHO ...............................................
ECHO SELECT SERVER or 0 to EXIT.
ECHO ...............................................
ECHO.
ECHO 1 - BACKUP INSTANCE SERVERNAME\INSTANCENAME
ECHO 0 - EXIT