Skip to content

Instantly share code, notes, and snippets.

View NCNecros's full-sized avatar

Stanislav NCNecros

View GitHub Profile
@NCNecros
NCNecros / gist:03e077c8466825a5ad73
Created September 29, 2014 06:27
mysql select to cvs
SELECT order_id,product_name,qty FROM orders
INTO OUTFILE '/tmp/orders.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
@NCNecros
NCNecros / Main.java
Created September 20, 2014 06:16
Вычисление остатка от деления n числа фибоначчи на m
package com.company;
import java.io.Reader;
import java.math.*;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
long n = s.nextLong();
@NCNecros
NCNecros / gist:1706e699671d006f2f5f
Created August 26, 2014 06:04
send email from python
import smtplib
from email.mime.text import MIMEText
me = 'admin@mail.ru'
you = 'kot_smit@mail.ru'
smtp_server = 'smtp.mail.ru'
msg = MIMEText('Message e-mail')
msg['Subject'] = 'The contents of '
msg['From'] = me
msg['To'] = you
s = smtplib.SMTP(smtp_server)
@NCNecros
NCNecros / HtmlParser.java
Created December 26, 2013 10:58
Helper for clean html with org.htmlcleaner
package libs.HtmlHelper;
import org.htmlcleaner.HtmlCleaner;
import org.htmlcleaner.TagNode;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
public class HtmlParser {
@NCNecros
NCNecros / PostRequest
Last active January 1, 2016 10:29
Get http response after post request
String urlParameters = new StringBuilder().append("search_type=2&p_ser=&p_num=").toString();
URLConnection connection = new URL(url).openConnection();
connection.setDoInput(true);
connection.setDoOutput(true);
//write to connection
OutputStreamWriter wr = new OutputStreamWriter(connection.getOutputStream ());
wr.write(urlParameters);
wr.flush();
//read response
BufferedReader in = new BufferedReader(