Skip to content

Instantly share code, notes, and snippets.

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

Konstantin Alikhanov atomAltera

🏠
Working from home
  • Nuclight
  • Tbilisi
View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
<div class="header">
<a class="btn" href="#">Click me</a>
@atomAltera
atomAltera / T_FileAttrs.java
Last active January 3, 2016 13:39
Simple cmd tool to extract and displat file attrs
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.LinkOption;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.attribute.*;
public class T_FileAttrs {
public static void print_usage() {
System.err.println("Usage: java Javast [-s] <path to file> [<path to file> ...]");
@atomAltera
atomAltera / T_Watcher.java
Last active January 3, 2016 14:19
Simple Java Watch Service implementation
import java.io.IOException;
import java.nio.file.*;
import static java.nio.file.StandardWatchEventKinds.*;
public class T_Watcher {
public static void main(String[] args) throws IOException {
Path target_path = Paths.get(args.length > 0 ? args[0] : "/");
WatchService w_serv = FileSystems.getDefault().newWatchService();
@atomAltera
atomAltera / T_ExecutorService.java
Created January 23, 2014 12:31
Simple Java example of using Executor Services
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.*;
public class T_ExecutorService {
public static void main(String[] args) throws InterruptedException {
ExecutorService ex = Executors.newFixedThreadPool(20);
System.out.printf("! Creating Executing service: %s%n", ex.getClass().getName());
System.out.println("! Submitting tasks");
@atomAltera
atomAltera / angular-facebook.js
Last active August 29, 2015 13:56
Facebook JS SDK for AngularJS
angular.module('Nuclight.Services.Facebook', [])
.provider('facebook', function () {
var fb_options = {};
var fb_lang = 'en_US';
this.init = function (options, lang) {
fb_options = options;
if (lang) fb_lang = lang;
};
@atomAltera
atomAltera / file_type_search.js
Last active August 29, 2015 13:56
Node.js async text files search
var fs = require('fs');
var mime = require('mime');
function file_type_search(path, mime_match, callback_all, callback_each) {
var file_list = [];
var level = 0;
if (typeof callback_all !== 'function') callback_all = false;
if (typeof callback_each !== 'function') callback_each = false;
@atomAltera
atomAltera / main
Created September 6, 2014 21:00
Loads from drive2.ru modles data
#!/usr/bin/env python3
import sys
from urllib.request import urlopen
import json
ERR_SUCCESS = 0
ERR_UNKNOWN = 1
ERR_MAKES_FILE_NOT_FOUND = 2
@atomAltera
atomAltera / exif-sorter.py
Last active September 13, 2016 03:38
Python script for sorting pictures based on EXIF date
import glob
from datetime import datetime
from os import makedirs
from shutil import copy
import exifread
from path import path
def process_file(file_path, dest_dir):
@atomAltera
atomAltera / google-calendar-fetch.py
Created December 14, 2016 06:41
Fetches holidays from Google calendar
from __future__ import print_function
import datetime
import json
import httplib2
from apiclient import discovery
from oauth2client import client
from oauth2client import tools
from oauth2client.file import Storage
@atomAltera
atomAltera / push_to.py
Created August 29, 2017 11:16
Testing APN
#!/usr/bin/env python
import binascii
import json
import socket
import ssl
import struct
import sys
def pack_payload(title, message, data=None, sound='Default', badge=1):