Skip to content

Instantly share code, notes, and snippets.

View LogIN-'s full-sized avatar
:electron:
Working from space

LogIN-

:electron:
Working from space
  • WWW
View GitHub Profile
@LogIN-
LogIN- / rsync_zfs_backup.sh
Created June 20, 2016 13:39
Make ZFS backups with rsync because of some reason. Usually its not good idea but hey maybe comes useful..
#!/bin/bash
# Crontab Entry - use flock to prevent duplicate running
30 3 * * 1 /usr/bin/flock -xn /root/logs/rsync_lock -c /usr/local/bin/rsync_scripts/rsync.sh >/dev/null 2>&1
# Resume broken network connection.
while [ 1 ]
do
rsync --log-file=/root/logs/rsync.log --verbose --delete --force --checksum --inplace --no-whole-file --update --append --archive --compress-level=9 --skip-compress=gz/zip/z/rpm/deb/iso/bz2/t[gb]z/7z/mp[34]/mov/avi/ogg/jpg/jpeg/lzo/rzip/lzma/rar/ace --acls --xattrs --compress --partial --human-readable --one-file-system --timeout=999 --exclude-from=/.rsync-filter -e "ssh -T -o ConnectTimeout=999 -o ServerAliveInterval=340 -c arcfour" /tank/drives/xxxxx/ serverxxxxx:/tank/drives/xxxxx
if [ "$?" = "0" ] ; then
#!/bin/bash
# Check new IPv4 addresses
# If address is not in iptables add rule
IPLISTV4=$(host maps.googleapis.com | grep -E 'has address' | awk '{print $4}')
for x in $IPLISTV4
do
$(iptables -L -nv | grep "$x" >> /dev/null)
if [[ "$?" -ne '0' ]]; then
@LogIN-
LogIN- / Yandex Music Grub
Last active September 12, 2015 08:01
download music from http://music.yandex.ru
<?php
class YandexMusic {
public static function getAlbumInfo($url) {
$req = file_get_contents($url);
$data = preg_match('/var\s+Mu\s+=\s+(.+?);\s+<\/script>/is', $req, $matches);
$data = json_decode($matches[1], true);
return $data['pageData'];
}
@LogIN-
LogIN- / dec2ternary.php
Created October 6, 2014 14:20
PHP Binary-> Decimal - Decimal->Ternary convert
<?php
$i = 100;
while ($i <= 150) {
$id = $i;
$start = microtime(true);
$binary_id_enc = dec2bin_i($id);
$binary_id_dec = bin2dec_i($binary_id_enc);
echo "-------------------------------------<br />";
@LogIN-
LogIN- / astro.php
Created October 4, 2014 15:38
PHP get astrological sign by date
<?php
function getsign($day,$month) {
if(($month==1 && $day>20)||($month==2 && $day<20)) {
$mysign = "aquarius";
}
if(($month==2 && $day>18 )||($month==3 && $day<21)) {
$mysign = "pisces";
}
if(($month==3 && $day>20)||($month==4 && $day<21)) {
$mysign = "aries";
@LogIN-
LogIN- / encode_decode.php
Last active January 29, 2023 18:29
PHP custom encode decode functions
<?php
// Updated code from comments
function encode($value) {
if (!$value) {
return false;
}
$key = sha1('EnCRypT10nK#Y!RiSRNn');
@LogIN-
LogIN- / rc4.php
Created October 4, 2014 11:50
rc4 php implementation
<?php
/*
* Copyright 2011 Michael Cutler <m@cotdp.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@LogIN-
LogIN- / MySQLInsertProcessorFactory.java
Created October 4, 2014 11:48
Java MySql insert example
package mysqlinsert.solr;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.Statement;
import java.util.Properties;
import org.apache.solr.common.SolrInputDocument;
@LogIN-
LogIN- / .conkyrc
Last active January 19, 2017 14:02
My .conkyrc configuration file
# conky configuration
#
# The list of variables has been removed from this file in favour
# of keeping the documentation more maintainable.
# Check http://conky.sf.net for an up-to-date-list.
#
# For ideas about how to modify conky, please see:
# http://crunchbanglinux.org/forums/topic/59/my-conky-config/
#
# For help with conky, please see:
@LogIN-
LogIN- / programming_ext.php
Created October 4, 2014 11:21
PHP list of all programming extensions
<?php
$extensions = array();
$extensions = json_decode('{"JavaScript+Mako":[["js+mako","javascript+mako"],[],["application\/x-javascript+mako","text\/x-javascript+mako","text\/javascript+mako"]],"Brainfuck":[["brainfuck","bf"],["bf","b"],["application\/x-brainfuck"]],"HTML+Cheetah":[["html+cheetah","html+spitfire"],[],["text\/html+cheetah","text\/html+spitfire"]],"Bash":[["bash","sh","ksh"],["sh","ksh","bash","ebuild","eclass"],["application\/x-sh","application\/x-shellscript"]],"CSS+Myghty":[["css+myghty"],[],["text\/css+myghty"]],"Coldfusion HTML":[["cfm"],["cfm","cfml","cfc"],["application\/x-coldfusion"]],"Smarty":[["smarty"],["tpl"],["application\/x-smarty"]],"Protocol Buffer":[["protobuf"],["proto"],[]],"ApacheConf":[["apacheconf","aconf","apache"],[".htaccess","apache.conf","apache2.conf"],["text\/x-apacheconf"]],"Java":[["java"],["java"],["text\/x-java"]],"JavaScript+Genshi Text":[["js+genshitext","js+genshi","javascript+genshitext","javascript+genshi"],[],["application\/x-javascript+genshi","text\/x