Skip to content

Instantly share code, notes, and snippets.

View isratmir's full-sized avatar
🍔
Focusing

Kozhomuratov Ulan isratmir

🍔
Focusing
  • Kyrgyzstan, Bishkek
View GitHub Profile

Categories tree with jqTree

UI for creating categories and subcategories example.

# Tweaked from http://tomislavsantek.iz.hr/2011/03/moving-mysql-databases-to-ramdisk-in-ubuntu-linux
# Log in as root
# Mount ramdisk folder in RAM
mkdir /tmp/ramdisk
mount -t tmpfs -o size=128M tmpfs /tmp/ramdisk/
# Move MySQL data
mv /var/lib/mysql /tmp/ramdisk/mysql
ln -s /tmp/ramdisk/mysql/ /var/lib/mysql
@isratmir
isratmir / patterns
Last active August 29, 2015 14:11
Regular Expression
\s - whitespace
\n - newline
\} - } symbol
\b\w+\b - select all words
<(.*?)> - everything like <div class="col-xs-12">
[a-z0-9_.]+(jpeg|jpg|png|gif) - "http://localhost/./files/pictures/picture_532.png"
@isratmir
isratmir / Parsesiteinfo.rb
Last active May 6, 2016 15:11
Site info parser
require 'rubygems'
require 'nokogiri'
require 'open-uri'
require 'json'
require 'net/http'
require 'uri'
require 'open_uri_redirections'
require 'openssl'
def ping url
@isratmir
isratmir / gist:5ce53695cfd8b3ae1516
Last active March 29, 2016 03:44
Parse namba playlist
require 'json'
require 'rubygems'
require 'nokogiri'
require 'open-uri'
require 'net/http'
file = File.read('music.json')
data_hash = JSON.parse(file)
var wfw = function(){
this.custom = {
trailerBrands: function(){
var brands = [];
function init() {
CKEDITOR.instances.TrailerBrands.on("loaded", function(){
CKEDITOR.instances.TrailerBrands.destroy(true);
$('#TrailerBrands').hide();
});
require 'mechanize'
require 'logger'
website = ARGV[0]
uname = ARGV[1]
upass = ARGV[2]
agent = Mechanize.new { |agent|
agent.open_timeout = 6
agent.read_timeout = 6
@isratmir
isratmir / forismatic.py
Created April 11, 2016 09:21
Read forismatic.com quotes from ubuntu cmd
#!/usr/bin/python
import sys
import os
import requests
import json
url = 'http://api.forismatic.com/api/1.0/'
params = dict(
<?php
private function getListing()
{
/*
$listingSid = \App()->Request['sid'];
$listing = \App()->ListingManager->getListingBySID($listingSid);
$json = $listing->getValueForEncodingToJson();
$newJson = array();
foreach ( $json as $k => $j ) {
$newJson[$k] = $j['value'];
@isratmir
isratmir / gethost.php
Last active October 20, 2016 08:46
Server's ip address from PHP's CLI
<?php
$host = gethostname();
$ip = gethostbyname($host);