Skip to content

Instantly share code, notes, and snippets.

# habraproxy.py — это простейший http-прокси-сервер, запускаемый локально (порт на ваше
# усмотрение), который показывает содержимое страниц Хабра. С одним исключением: после
# каждого слова из шести букв должен стоять значок «™». Примерно так:
#
# http://habrahabr.ru/company/yandex/blog/258673/
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# Сейчас на фоне уязвимости Logjam все в индустрии в очередной раз обсуждают проблемы и
# особенности TLS. Я хочу воспользоваться этой возможностью, чтобы поговорить об одной из
# них, а именно — о настройке ciphersiutes.
#
@jonico
jonico / Jenkinsfile
Last active January 31, 2024 09:43
Example for a full blown Jenkins pipeline script with CodeQL analysis steps, multiple stages, Kubernetes templates, shared volumes, input steps, injected credentials, heroku deploy, sonarqube and artifactory integration, Docker containers, multiple Git commit statuses, PR merge vs branch build detection, REST API calls to GitHub deployment API, …
#!groovy
import groovy.json.JsonOutput
import groovy.json.JsonSlurper
def label = "mypod-${UUID.randomUUID().toString()}"
podTemplate(label: label, yaml: """
spec:
containers:
- name: mvn
image: maven:3.3.9-jdk-8
@Shipaaaa
Shipaaaa / mvi.md
Last active January 25, 2024 10:31

Материалы для вхождения в MVI

Открытые вопросы

  • Что такое единый стейт? Если экран сложный, то как описывать сложные стейты. Если через seald class, то по какому принципу описывать seald class со стейтом?
  • Как работать с single liveData (map/distinct?)
  • Как работать с command liveData? Нужно разделить общие команды и приватные для каждого экрана.
  • Как подружить liveData и state-delegate? Какую сделать структуры обертки для загружаемых данных(Loading, Content, Error).
  • Как обрабатывать пересоздание диалогов (как подсунуть новую лямбду) Нужно посмотреть сюда.
@emil2k
emil2k / Connectivity.java
Last active December 22, 2023 06:03
Android utility class for checking device's network connectivity and speed.
/*
* Copyright (c) 2017 Emil Davtyan
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
@paulocaldeira17
paulocaldeira17 / AppBarStateChangeListener.java
Last active December 21, 2023 09:50
Android AppBarLayout collapsed/expanded state listener
import android.support.design.widget.AppBarLayout;
/**
* App bar collapsing state
* @author Paulo Caldeira <paulo.caldeira@acin.pt>.
*/
public abstract class AppBarStateChangeListener implements AppBarLayout.OnOffsetChangedListener {
// State
public enum State {
EXPANDED,
@jacksoncage
jacksoncage / jenkins-slave
Last active December 8, 2023 23:40
Bash script to check if a Jenkins slave node is offline and will restart node java process.
#!/bin/sh
#
# jenkins-slave: Launch a Jenkins BuildSlave instance on this node
#
# chkconfig: - 99 01
# description: Enable this node to fulfill build jobs
#
JENKINS_WORKDIR="/var/jenkins"
JENKINS_USER="jenkins"
@mitchwongho
mitchwongho / Docker
Last active November 29, 2023 06:36
Docker 'run' command to start an interactive BaSH session
# Assuming an Ubuntu Docker image
$ docker run -it <image> /bin/bash
@lost-theory
lost-theory / gist:3928813
Created October 21, 2012 22:48
flask dynamic url_prefix for blueprints
from flask import Flask, Blueprint, request
## blueprint ##################################################################
bp = Blueprint('category_functionality', __name__)
@bp.route('/')
def index(category):
return "this is the index page for %r" % category
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.security.KeyPairGeneratorSpec;
import android.text.TextUtils;
import android.util.Base64;
import android.util.Log;
import java.io.ByteArrayInputStream;
@ibeex
ibeex / foo.log
Created August 4, 2012 13:46
Flask logging example
A warning occurred (42 apples)
An error occurred