Skip to content

Instantly share code, notes, and snippets.

Avatar

Viktor Manyushin vmanyushin

View GitHub Profile
View gist:2f646123d44858f464aed07a94e35c5b
package com.example.swop.avcrmmobile;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
public class StubService extends Service {
public StubService() {
}
View dump SQL queries
#!/bin/bash
#this script used monitor mysql network traffic.echo sql
tcpdump -i eno1 -s 0 -l -w - dst port 3306 | strings | perl -e '
while(<>) { chomp; next if /^[^ ]+[ ]*$/;
if(/^(SELECT|UPDATE|DELETE|INSERT|SET|COMMIT|ROLLBACK|CREATE|DROP|ALTER|CALL)/i)
{
if (defined $q) { print "$q\n"; }
$q=$_;
} else {
$_ =~ s/^[ \t]+//; $q.=" $_";
View балансировка через редирект на nginx
split_clients "${remote_addr}${http_user_agent}${date_gmt}" $variant {
25% dg1;
25% dg2;
25% dg3;
25% dg4;
}
server {
listen 80;
listen 443 ssl;
View PS1
PS1="\n\[\e[30;1m\]\[\016\]l\[\017\][\[\e[34;1m\]\u@\h\[\e[30;1m\]]-[\[\e[34;1m\]\t\[\e[30;1m\]]->\[\e[30;1m\]\n\[\016\]m\[\017\]-[\[\[\e[32;1m\]\w\[\e[30;1m\]]-[\[\e[32;1m\]\$(/bin/ls -1 | /usr/bin/wc -l | /bin/sed 's: ::g') files, \$(/bin/ls -lah | /bin/grep -m 1 total | /bin/sed 's/total //')b\[\e[30;1m\]]--> \[\e[0m\]"
View Unencrypt private RSA key
openssl rsa -in ~/.ssh/id_rsa -out ~/.ssh/id_rsa.nocrypt
mv ~/.ssh/id_rsa.nocrypt ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
@vmanyushin
vmanyushin / lookuphost.go
Created Oct 25, 2016
golang net.LookupHost wrapper for timeout's
View lookuphost.go
package main
import (
"net"
"time"
"fmt"
"errors"
)
func main() {
@vmanyushin
vmanyushin / convert.sh
Last active Aug 31, 2016
сконвертировать PDF в картинку и наложить печать и подпись поверх
View convert.sh
#!/bin/bash
#
# author: vmanyushin@gmail.com
# created: 31.08.2016
# description: скрипт добавляет печать и подпись на документ.
# для работы скрипта в системе должен быть установлен imagemagick пакет
#
# описание параметров:
# $1 - имя исходного файла
# $2 - имя файла с печатью
@vmanyushin
vmanyushin / dbf2csv.py
Created Mar 30, 2016
Convert dbf to csv
View dbf2csv.py
#!/usr/bin/python
import csv
from dbfpy import dbf
import os
import sys
filename = sys.argv[1]
if filename.endswith('.dbf'):
print "Converting %s to csv" % filename
View gist:a1829c1ac15ed55bd7ac
function isMobile() {
var a = (navigator.userAgent||navigator.vendor||window.opera);
if(/android.+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od|ad)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu
View Чистка виря с Eval в первой строке
find ./ -name '*.php' -exec grep -l '^<?php.*eval' {} \; | xargs sed -i '1s/.*/<?php/'
find ./ -name '*.php' -o -name '*.html' -exec grep -l '<script id="data:text/javascript;charset=utf-8;base64' {} \; | xargs sed -i 's#^<script id="data:text/javascript;charset=utf-8;base64.*$##g'
You can’t perform that action at this time.