Skip to content

Instantly share code, notes, and snippets.

View kreshikhin's full-sized avatar
🏠
Working from home

Denis Kreshikhin kreshikhin

🏠
Working from home
View GitHub Profile
@kreshikhin
kreshikhin / agents.md
Created November 9, 2015 10:08 — forked from Paratron/agents.md
Social Network Crawler User Agents

#Social Network Crawler User Agents Users can post URLs on a lot of different platforms nowadays. Most of those platforms will send a request to that URL to generate some preview data from it.

These are a couple of user agents I quickly tested out.

##Facebook

facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)
@kreshikhin
kreshikhin / add-ssh-to-remote-server.sh
Created August 3, 2015 08:42
This code adds ssh key to remtoe server
cat ~/.ssh/id_rsa.pub | ssh user@hostname 'cat >> .ssh/authorized_keys'
/* http-client.c
*
* Copyright (c) 2000 Sean Walton and Macmillan Publishers. Use may be in
* whole or in part in accordance to the General Public License (GPL).
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
extern crate http;
extern crate nickel;
use std::io::File;
use std::str::from_utf8_owned;
use std::io::net::ip::Ipv4Addr;
use nickel::{ Nickel, Request, Response };
fn main() {
let mut server = Nickel::new();
@kreshikhin
kreshikhin / compileShader
Created April 24, 2015 15:47
method compiled a shader code
func compileShader(code: String, shaderType: GLenum) -> GLuint {
var shader = glCreateShader(shaderType)
var cStringSource = (code as NSString).UTF8String
let stringfromutf8string = String.fromCString(cStringSource)
glShaderSource(shader, GLsizei(1), &cStringSource, nil)
glCompileShader(shader);
var isCompiled: GLint = 0
5 REM From the ZX Spectrum manual on Drawing primitives
6 DIM x1, y1, x2, y2, c AS INTEGER
10 BORDER 0: PAPER 0: INK 7: CLS: REM turn screen blank
20 LET x1 = 0: LET y1 = 0: REM line start
30 LET c = 1: REM Ink color starting from blue
40 LET x2 = INT(RND * 256): LET y2 = INT(RND * 176): REM Random line end
50 DRAW INK c; x2 - x1, y2 - y1
60 LET x1 = x2: LET y1 = y2: REM Next line starts at current one's ending
70 LET c = c + 1: IF c = 8 THEN LET c = 1: END IF: REM Next color
REM Sample circle drawing without using the CIRCLE command
DIM i, r, x, y, q AS FLOAT
DIM ax, ay, zx, zy, dx, dy AS INTEGER
x = 127
y = 87
r = 40
q = 1 / r
// window.saveAs
// Shims the saveAs method, using saveBlob in IE10.
// And for when Chrome and FireFox get round to implementing saveAs we have their vendor prefixes ready.
// But otherwise this creates a object URL resource and opens it on an anchor tag which contains the "download" attribute (Chrome)
// ... or opens it in a new tab (FireFox)
// @author Andrew Dodson
// @copyright MIT, BSD. Free to clone, modify and distribute for commercial and personal use.
window.saveAs || ( window.saveAs = (window.navigator.msSaveBlob ? function(b,n){ return window.navigator.msSaveBlob(b,n); } : false) || window.webkitSaveAs || window.mozSaveAs || window.msSaveAs || (function(){
class User
field :first_name, String
field :last_name, String
field :email_name, String
context AdminAccess
def show
end
div.row-fluid.well
div.row-fluid(data-bind="css: {excluded: excluded}")
div.row-fluid
div.span1
| ТЕМА
div.span8
input(style="width: 100%;" type="text" data-bind="value: title, valueUpdate: 'afterkeydown'")
div.span2.pull-right
/! /ko ifnot: changed()
span.texton(data-bind="click:$root.send_to_all") РАЗОСЛАТЬ ВСЕМ