Skip to content

Instantly share code, notes, and snippets.

View x1unix's full-sized avatar
:shipit:
Work in progress

Denys Sedchenko x1unix

:shipit:
Work in progress
View GitHub Profile
@x1unix
x1unix / KinopoiskRequestInterceptor.java
Created November 10, 2016 20:35
Http interceptor for Kinopoisk API
package com.x1unix.avi.kp;
import org.apache.commons.codec.digest.DigestUtils;
import java.io.IOException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;
import okhttp3.HttpUrl;
@x1unix
x1unix / no-ad.js
Created November 29, 2016 11:45
TJOURNAL_NO_AD
$('.b-feed-adblock').remove() && $('html').removeClass('m-blurry');
@x1unix
x1unix / grab.php
Created December 9, 2016 10:58
Moonwalk Grabber
<?php
function grabPOST($url, $postDATA, $iOS = true) {
$ch = curl_init();
$ua = 'Mozilla/5.0 (iPad; CPU OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25';
if ($iOS!==false) curl_setopt($ch, CURLOPT_USERAGENT, $ua);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_POST, TRUE);
@x1unix
x1unix / cur-branch.sh
Created January 12, 2017 11:53
Show current git branch
git rev-parse --abbrev-ref HEAD
@x1unix
x1unix / class_decorator.ts
Created March 15, 2017 11:57 — forked from remojansen/class_decorator.ts
TypeScript Decorators Examples
function logClass(target: any) {
// save a reference to the original constructor
var original = target;
// a utility function to generate instances of a class
function construct(constructor, args) {
var c : any = function () {
return constructor.apply(this, args);
}
@x1unix
x1unix / MyClass.java
Last active March 21, 2017 12:45
Moonwalker example
import com.x1unix.moonwalker;
import okhttp3.OkHttpClient;
class MyClass {
private static final String MOVIE_KINOPOISK_ID = "502838";
public static void main() {
Moonwalker moonwalker = new Moonwalker('http://mysite.com/');
moonwalker.getMovieByKinopoiskId(MOVIE_KINOPOISK_ID,
new Listener() {
@Override
@x1unix
x1unix / _verify-repair-permissions-disk.md
Created April 11, 2017 21:28 — forked from bzerangue/_verify-repair-permissions-disk.md
Mac OS X Utilities via Terminal: (Verify and Repair: Disk Permissions AND Disk / Software Update / TimeMachine)

Verify and Repair Disk Permissions via Terminal (Mac OS X)

Verify Permissions

diskutil verifyPermissions /

Repair Permissions

diskutil repairPermissions /

@x1unix
x1unix / app.component.ts
Created April 22, 2017 02:31
Angular 2 Route - Change page title based on route
import { Component, OnInit } from '@angular/core';
import { isNil } from 'lodash';
import { ActivatedRoute, Router, NavigationEnd } from '@angular/router';
import { Title } from '@angular/platform-browser';
@Component({
selector: 'l2-app', // <my-app></my-app>
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],
})
@x1unix
x1unix / run.sh
Created May 23, 2017 22:14
Install Node 6.x On Ubuntu
curl -sL https://deb.nodesource.com/setup_6.x | sudo bash
sudo apt-get install nodejs
@x1unix
x1unix / calc.go
Last active July 6, 2017 14:39
Simple Calculator with Go
package main
import "fmt"
const (
O_NOTHING float32 = iota
O_ADD float32 = iota
O_SUBSTRACT float32 = iota
O_MULTIPLY float32 = iota
O_DIVIDE float32 = iota