Skip to content

Instantly share code, notes, and snippets.

View KarateJB's full-sized avatar
💭
May the Force be with you.

JB KarateJB

💭
May the Force be with you.
View GitHub Profile
@KarateJB
KarateJB / gist:d4354e20c803db02aaea8757cc06e854
Created July 9, 2021 14:58
[Vim] Markdown configuration
" Default options for Markdown file
set tabstop=2
set expandtab
set spell
set hidden
@KarateJB
KarateJB / .gitignore
Last active July 9, 2021 14:57
[Git] .gitignore for Vim
# Swap
[._]*.s[a-v][a-z]
!*.svg # comment out if you don't need vector files
[._]*.sw[a-p]
[._]s[a-rt-v][a-z]
[._]ss[a-gi-z]
[._]sw[a-p]
# Session
Session.vim
@KarateJB
KarateJB / k8s.conf
Created May 7, 2021 11:25 — forked from blachniet/k8s.conf
Ansible playbook to install Minikube on a VM with the "none" driver. Add your inventory in a file named `hosts`, then execute the playbook with `ansible-playbook --ask-become-pass -i hosts ./playbook.yml`
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
@KarateJB
KarateJB / EF Core View example.cs
Created July 22, 2020 11:11
[ASP.NET Core 2.2] EF Core View example
[Table("VwDatas")]
public class VwData
{
public string Name { get; set; }
public int Cnt { get; set; }
}
public class MyDbContext : DbContext
{
public MyDbContext(DbContextOptions<MyDbContext> options)
@KarateJB
KarateJB / 1.FlatFiles.FixLength.Reader-Model.cs
Last active July 22, 2020 11:04
jehugaleahsa/FlatFiles sample codes
/*
* FlatFiles: https://github.com/jehugaleahsa/FlatFiles
* Sample code: https://github.com/jehugaleahsa/FlatFiles/issues/63
*/
internal class MyModel
{
[MaxLength(5)]
public string Prop1 {get; set;}
@KarateJB
KarateJB / Kill_Sessions.sql
Created March 2, 2020 05:02
PostgreSQL SQL
SELECT
pg_terminate_backend(pid)
FROM
pg_stat_activity
WHERE
-- don't kill my own connection!
pid <> pg_backend_pid()
-- don't kill the connections to other databases
AND datname = 'my_database_name';
@KarateJB
KarateJB / GetAllCacheEntries.cs
Created February 14, 2020 06:57
[.NET Core] Get all entries from MemoryCache
/// <summary>
/// Get all CacheEnries in MemoryCache
/// </summary>
/// <param name="cache">IMemoryCache</param>
/// <returns>List of CacheEntry</returns>
public static IList<ICacheEntry> GetAllCacheEntries(this IMemoryCache cache)
{
// CacheEtries
var cacheEntries = new List<ICacheEntry>();
@KarateJB
KarateJB / [ASP.NET Core] Data Protection - ApiController.cs
Last active January 13, 2020 09:24
[ASP.NET Core] Data Protection with TripleDES
[AllowAnonymous]
[Route("[controller]")]
[ApiExplorerSettings(IgnoreApi = true)]
public class HomeController : Controller
{
private readonly ILogger<HomeController> logger = null;
private readonly IDataProtectService cipher = null;
/// <summary>
/// Constructor
@KarateJB
KarateJB / license-badges.md
Created October 3, 2019 02:06 — forked from lukas-h/license-badges.md
Markdown License Badges for your Project

Markdown License badges

Collection of License badges for your Project's README file.
This list includes the most common open source and open data licenses.
Easily copy and paste the code under the badges into your Markdown files.

Notes