Skip to content

Instantly share code, notes, and snippets.

View atomize's full-sized avatar
🎹
♩♩

Berti atomize

🎹
♩♩
View GitHub Profile
@atomize
atomize / 256-colors.sh
Created May 28, 2017 19:13
Bash terminal 256 colors escape sequences. The following script display the 256 colors available on some terminals and terminals emulators like XTerm and GNOME Terminal.
#!/bin/bash
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want
# To Public License, Version 2, as published by Sam Hocevar. See
# http://sam.zoy.org/wtfpl/COPYING for more details.
for fgbg in 38 48 ; do #Foreground/Background
for color in {0..256} ; do #Colors
@atomize
atomize / 16_colors_and_formatting.sh
Created May 28, 2017 19:12
Bash 16 colors and formatting escape sequences.The following shell script displays a lot of possible combination of the attributes (but not all, because it uses only one formatting attribute at a time). [SOURCE: http://misc.flogisoft.com/bash/tip_colors_and_formatting]
#!/bin/bash
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want
# To Public License, Version 2, as published by Sam Hocevar. See
# http://sam.zoy.org/wtfpl/COPYING for more details.
#Background
for clbg in {40..47} {100..107} 49 ; do
@atomize
atomize / printonlyafterstring.sed
Created March 13, 2017 07:14
Prints only what is after printonlywhatsafterme
sed -n -e 's/^.*printonlywhatsafterme //p' textfile.txt
@atomize
atomize / SambaRestartGraceful.sh
Created March 9, 2017 19:26
Graceful samba reload to recognize changes to smb.conf without restart, as root:
#RUN AS ROOT
# To get samba to recognize changes to its smb.conf *without restart*, as root:
# 1) First test your configuration file for errors:
testparm /path/to/smb.conf; echo $?
#If it exits '0' you're good to go.
# 2) Find the parent SMBD
ps -ef | grep smbd
@atomize
atomize / gist.cmd.txt
Created March 9, 2017 08:09
Testing a gist from the command line
Testing gist command line
@atomize
atomize / ffmpeg to webm.sh
Created March 4, 2017 07:29
ffmpeg mov to webm
ffmpeg -i $(IN) -c:v libvpx -pass 1 -an -f rawvideo -y /dev/null # Generates ffmpeg2pass-0.log
ffmpeg -i $(IN) -c:v libvpx -pass 2 -f webm -b:v 400K -crf 10 -an -y $(OUT).webm
@atomize
atomize / customCSScursor.css
Created February 20, 2017 18:37
Give a custom cursor with CSS over all DOM elements, or even just some DOM elements.
*{cursor:url("//URI.to.customcursor.png"),default!important}*
body a,.arrow,button,a.progress,div.expando-button{cursor:url("//URI.to.customcursor.png"),!important}
@atomize
atomize / RemoveDupes
Created November 6, 2013 17:30
Outputs non-duplicate column data for all columns based on specfied input [column 1, in example code. Removes duplicates.
' !x[$1]++'
#!/usr/bin/php
<?php
/*
* Convert JSON file to CSV and output it.
*
* JSON should be an array of objects, dictionaries with simple data structure
* and the same keys in each object.
* The order of keys it took from the first element.
*
* Example: