Skip to content

Instantly share code, notes, and snippets.

View lentiummmx's full-sized avatar

lentiummmx lentiummmx

View GitHub Profile
@evgenyneu
evgenyneu / setup_cursor_ubuntu.md
Last active August 11, 2025 11:15
Install Cursor AI code editor on Ubuntu 24.04 LTS

Install Cursor AI editor on Ubuntu 24.04

  1. Use the Download button on www.cursor.com web site. It will download the NAME.AppImage file.

  2. Copy the .AppImage file to your Applications directory

cd ~/Downloads
mkdir -p ~/Applications
mv NAME.AppImage ~/Applications/cursor.AppImage
@bibarsov
bibarsov / AppConfig.java
Last active May 29, 2025 15:25
Spring / Hikari / Postgres / Multiple datasources
package test.app.config;
import com.zaxxer.hikari.HikariDataSource;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.DependsOn;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
@a-recknagel
a-recknagel / .coveragerc
Created August 28, 2019 14:13
gitlab CI template
[run]
branch = True
source = my_django_lib
omit =
src/my_django_lib/settings.py
*/__init__.py
[paths]
source = src
@iamaziz
iamaziz / read_csv_files_in_tar_gz_from_s3_bucket.py
Last active November 22, 2022 14:45
Read csv files from tar.gz in S3 into pandas dataframes without untar or download (using with S3FS, tarfile, io, and pandas)
# -- read csv files from tar.gz in S3 with S3FS and tarfile (https://s3fs.readthedocs.io/en/latest/)
bucket = 'mybucket'
key = 'mycompressed_csv_files.tar.gz'
import s3fs
import tarfile
import io
import pandas as pd
@edudobay
edudobay / git-branch-protection.md
Last active August 26, 2024 14:56
Command-line script for protecting/unprotecting branches in a GitHub repository

(To be improved)

Requirements

  • httpie (which provides the http command) — pip install httpie

Setup

  • Save the git-branch-protection.sh as git-branch-protection somewhere in your path (something like ~/bin or ~/.local/bin if you already use it)
  • Generate a GitHub token and save it as ~/.config/github_token.
@tristansokol
tristansokol / linear-regression-tensorflow.html
Created June 30, 2018 03:53
linear regression with tensorflow
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/[email protected]"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.2/Chart.bundle.min.js"></script>
<div style="width:400px;">
<canvas id="myChart" width="400" height="400"></canvas>
</div>
<button onclick="train()">Train the model 1 step</button>
<script>
const trainX = [
3.3,
@Geekfish
Geekfish / patch_with_reload.py
Last active July 27, 2023 08:44
Same as patch, but allows you to pass a module object which will be reloaded when entering/leaving the context.
import imp
from functools import partial
from mock.mock import _patch, _get_target, DEFAULT
class PatchWithReload(_patch):
def __init__(self, module_to_reload, *args, **kwargs):
self.module_to_reload = module_to_reload
super(PatchWithReload, self).__init__(*args, **kwargs)
@arcaduf
arcaduf / Python: read and dump dictionary to YAML preserving order
Created January 15, 2018 10:08
Python: read and dump dictionary to YAML preserving order
```python
import collections , yaml
_mapping_tag = yaml.resolver.BaseResolver.DEFAULT_MAPPING_TAG
def dict_representer(dumper, data):
return dumper.represent_mapping(_mapping_tag, data.iteritems())
def dict_constructor(loader, node):
return collections.OrderedDict(loader.construct_pairs(node))
@LuisErnestoZamb
LuisErnestoZamb / 2017-11-29_15-08-33.jpg
Last active May 14, 2025 20:22
How setting up mysql as localhost and using this outside docker on Mac OS (accessing localhost mysql from docker) - The missing guide
2017-11-29_15-08-33.jpg
@kubaszumiato
kubaszumiato / safe.pipe.ts
Created March 23, 2017 20:04
Angular safe pipe implementation to bypass DomSanitizer stripping out content
import {Pipe} from '@angular/core';
import {DomSanitizer, SafeHtml, SafeStyle, SafeScript, SafeUrl, SafeResourceUrl} from '@angular/platform-browser';
//https://forum.ionicframework.com/t/inserting-html-via-angular-2-use-of-domsanitizationservice-bypasssecuritytrusthtml/62562/2
@Pipe({
name: 'safe'
})
export class SafePipe {
constructor(protected _sanitizer: DomSanitizer) {