Skip to content

Instantly share code, notes, and snippets.

View SemenMartynov's full-sized avatar
:octocat:
Yes, we code!

Semen Martynov SemenMartynov

:octocat:
Yes, we code!
View GitHub Profile
@SemenMartynov
SemenMartynov / gist:b73785ae4dbf8f8fa34e
Created November 22, 2014 14:58
Evgeny Golovachyov
// Evgeny Golovachyov
#include <string>
#include <utility>
typedef std::pair<std::string, int> Obj;
int main() {
using namespace std;
Obj object("Ololo", 1234);
class ImagePanel extends JPanel {
private static final long serialVersionUID = 1L;
private Image img;
public ImagePanel(Image img) {
this.img = img;
}
public void paintComponent(Graphics g) {
int min = Math.min(getWidth(), getHeight());
<?xml version="1.0" encoding="utf-8"?>
<response list="true">
<count>38698</count>
<audio>
<aid>75774002</aid>
<owner_id>12186866</owner_id>
<artist>AC/DC</artist>
<title>Highway To Hell </title>
<duration>208</duration>
<url>http://cs4496.vk.me/u32436943/audios/855004beef40.mp3</url>
@SemenMartynov
SemenMartynov / Tweetily's log
Created August 6, 2013 00:54
Tweetily must automatically promote posts or pages from WordPress on Twitter.
1375632022 In function get_request_tokenThe last tweet in : August 4, 2013, 4:00 pm
1375632022 ..params are Array
(
[oauth_consumer_key] => x1f7w1y3gu8WFMgWramMQ
[oauth_callback] => https://cloudtips.org/wp-admin/admin.php?page=Tweetily&amp;TOP_oauth=1
[oauth_signature_method] => HMAC-SHA1
[oauth_timestamp] => 1375632022
[oauth_nonce] => cd326ee12019b4beb349b9b47cd6b25c
[oauth_version] => 1.0
)
@SemenMartynov
SemenMartynov / Apache Kafka on Ubuntu.txt
Last active September 5, 2018 07:37
kafka installation on ubuntu 16.04
Install and configure Apache Kafka on Ubuntu 16.04
1. Install Java (JDK8)::
Add the repository
$ sudo add-apt-repository -y ppa:webupd8team/java
Update the metadata of the new repository and install JDK
@SemenMartynov
SemenMartynov / producer-consumer.cpp
Created September 25, 2020 10:37
[Multiple producer - one consumer] with the modern C++
#include <thread>
#include <iostream>
#include <queue>
#include <mutex>
#include <algorithm>
#include <condition_variable>
#include <atomic>
#include <random>
std::mutex mtx;
@SemenMartynov
SemenMartynov / Cinnamon.md
Created April 6, 2022 09:18
Оптимизация потребления памяти Cinnamon

Cinnamon

Cinnamon, или дословно корица, это форк GNOME 3, который был создан разработчиками Linux Mint для исправления проблем своего родителя, когда последний был в крайне нестабильном состоянии. И отчасти ему это удалось, но одну из главных проблем GNOME он, к сожалению, унаследовал - это большое потребление оперативной памяти и других ресурсов компьютера. Поэтому здесь мы поговорим об оптимизации нашей булочки корицей.

Отключение ненужных CSD служб

Будучи форком GNOME 3, Cinnamon также имеет свой аналог GSD служб, которые называются CSD службами (Cinnamon Settings Daemon). Принципиальных различий от GSD служб у них по сути нет, просто другое название и немного измененный состав.

cd /usr/lib/cinnamon-settings-daemon # Переходим в директорию где находятся все CSD-службы.
@SemenMartynov
SemenMartynov / GitLabGrooming.py
Created April 4, 2024 19:13
Sometimes a situation arises when a huge number of logs from the workers accumulate on the GitLab server (dozens of gigabytes in my case). And it’s impossible to delete them manually, because the pipelines are not displayed in the WebUI. In this case, you need to go through all the jobs, get the pipeline ID from them, and use it for cleaning.
from concurrent.futures import ThreadPoolExecutor
from functools import partial
from datetime import datetime
import requests
import json
# Config
MAX_THREADS = 24
CUTOFF_DATE = datetime.fromisoformat("2024-02-01T00:00:00.000+03:00")
GITLAB_TOKEN = "glpat-XXXZZZXXXZZZn_XXXZZZ"