Skip to content

Instantly share code, notes, and snippets.

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

Serhii Pirohov SergeyPirogov

🏠
Working from home
View GitHub Profile
@adrianherrera
adrianherrera / gen-clang-ast.py
Last active October 10, 2024 22:12
Generate a Clang AST in JSON format
#!/usr/bin/env python3
"""
Generate a Clang AST (in JSON format) from a compilation database. Adapted from
run-clang-format.py.
I use [bear](https://github.com/rizsotto/Bear) to generate the compilation
database.
Author: Adrian Herrera
@ines
ines / diff_strings.py
Created August 1, 2019 12:19
Print colored visual diff in Python
import difflib
import wasabi
def diff_strings(a, b):
output = []
matcher = difflib.SequenceMatcher(None, a, b)
for opcode, a0, a1, b0, b1 in matcher.get_opcodes():
if opcode == "equal":
output.append(a[a0:a1])
elif opcode == "insert":
@avermeulen
avermeulen / 01-setup-new-typescript-project.md
Last active February 17, 2025 12:56
TypeScript basics with Mocha setup - learn how to use interfaces

Setup a new TypeScript project with Mocha support

Ensure you have TypeScript installed globally using this command:

npm install -g typescript

This outlines how to setup a new TypeScript project with mocha support.

@liemle3893
liemle3893 / Docker-multistage-example.MD
Last active December 20, 2024 20:27
Docker Multistage + Spring Boot = Smaller Container Sized

docker-multi-stage

Spring Boot + Docker Multistage = Smaller container size

Use can use prebuild version by using:

$ docker run -d -p 8080:8080 saboteurkid/smaller-spring:1.0

Wait for docker to pull and up. Then jump to step #6

1. Clone example project from Spring Boot repository

@nerro
nerro / helper.gradle
Last active October 27, 2023 10:20
Gradle: task 'resolveDependencies' for CI
task resolveDependencies {
setDescription "Resolves all projects dependencies from the repository."
setGroup "Build Server"
doLast {
rootProject.allprojects { project ->
project.buildscript.configurations.forEach { configuration ->
if (configuration.canBeResolved) {
configuration.resolve()
}
@juananpe
juananpe / HelloWSS.java
Created October 24, 2017 19:07
Get wss://ws-feed.gdax.com stream
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.neovisionaries.ws.client.WebSocket;
import com.neovisionaries.ws.client.WebSocketAdapter;
import com.neovisionaries.ws.client.WebSocketFactory;
/**
* Mendekotasunak: (maven bidez instalatu)
* gson-2.8.2
* nv-websocket-client-2.3
@rambabusaravanan
rambabusaravanan / lambda-email.py
Last active November 7, 2023 03:35
AWS Lambda Function to send SMTP Email
import smtplib
import os
def send_email(host, port, username, password, subject, body, mail_to, mail_from = None, reply_to = None):
if mail_from is None: mail_from = username
if reply_to is None: reply_to = mail_to
message = """From: %s\nTo: %s\nReply-To: %s\nSubject: %s\n\n%s""" % (mail_from, mail_to, reply_to, subject, body)
print (message)
try:
@ldzm
ldzm / libclang_show_ast.py
Created November 4, 2016 14:27 — forked from anonymous/libclang_show_ast.py
Show the AST of a translation unit with libclang and python
# inspired by http://eli.thegreenplace.net/2011/07/03/parsing-c-in-python-with-clang/
import sys
import clang.cindex
def verbose(*args, **kwargs):
'''filter predicate for show_ast: show all'''
return True
def no_system_includes(cursor, level):
'''filter predicate for show_ast: filter out verbose stuff from system include files'''
@chinshr
chinshr / Jenkinsfile
Last active February 9, 2025 02:39
Best of Jenkinsfile, a collection of useful workflow scripts ready to be copied into your Jenkinsfile on a per use basis.
#!groovy
# Best of Jenkinsfile
# `Jenkinsfile` is a groovy script DSL for defining CI/CD workflows for Jenkins
node {
}