Skip to content

Instantly share code, notes, and snippets.

View littlebeeper's full-sized avatar

Cuneyt Ozen littlebeeper

View GitHub Profile
@littlebeeper
littlebeeper / docker-debug.md
Created November 4, 2023 18:28 — forked from rordi/docker-debug.md
Docker debugging an existing image

Debugging a Docker image

Start up the Docker container from image:

docker run --entrypoint "/bin/bash" --rm imagename:latest -c "sleep 24h"

Obtain the container hash id:

docker ps
@littlebeeper
littlebeeper / backup-github.sh
Created February 28, 2023 14:49 — forked from rodw/backup-github.sh
A simple script to backup an organization's GitHub repositories, wikis and issues.
#!/bin/bash
# A simple script to backup an organization's GitHub repositories.
#-------------------------------------------------------------------------------
# NOTES:
#-------------------------------------------------------------------------------
# * Under the heading "CONFIG" below you'll find a number of configuration
# parameters that must be personalized for your GitHub account and org.
# Replace the `<CHANGE-ME>` strings with the value described in the comments
# (or overwrite those values at run-time by providing environment variables).
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.temporal.TemporalAdjusters;
import java.util.*;
public class LegendOfEffectiveDate {
@littlebeeper
littlebeeper / tabulator-multi-value-edit.html
Last active January 14, 2021 11:52
Editing multiple cell values with tabulator
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Tabulator multivalue edit</title>
<link href="https://unpkg.com/[email protected]/dist/css/tabulator.min.css" rel="stylesheet">
<script type="text/javascript" src="https://unpkg.com/[email protected]/dist/js/tabulator.min.js"></script>
</head>
<body>
<div id="example-table"></div>
@littlebeeper
littlebeeper / moduleName.js
Last active March 18, 2021 06:20
Simple javascript module declaration
const moduleName = ((wnd,doc,$)=>{
'use strict';
const onReady = (callback)=>{
if (doc.readyState !== "loading")
callback();
else
doc.addEventListener("DOMContentLoaded", callback);
}
onReady(()=>{
@littlebeeper
littlebeeper / cqlsh_intro.cql
Created April 27, 2020 16:44 — forked from jeffreyscarpenter/cqlsh_intro.cql
Introduction to CQL / cqlsh
#
# cqlsh_intro.cql
#
# Copyright (C) 2017 Jeff Carpenter
# Execute the commands in this file for a short guided tour of the CQL Shell (cqlsh)
#
# For more description, see Cassandra, The Definitive Guide 2nd Ed., Chapter 3: Installing
# http://shop.oreilly.com/product/0636920043041.do
#
private static String convertToGMT(String epoch) {
Date date = new Date(Long.parseLong(epoch));
String GMT_FORMAT = "yyyy-MM-dd HH:mm:ss";
SimpleDateFormat dateFormat = new SimpleDateFormat(GMT_FORMAT);
dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
// Calendar calendar = Calendar.getInstance();
// calendar.setTimeInMillis(entityAttribute.toInstant().toEpochMilli());
// calendar.setTimeZone(TimeZone.getTimeZone(entityAttribute.getZone()));
@littlebeeper
littlebeeper / CreditcardMasker.java
Created November 5, 2018 09:09 — forked from ariesmcrae/CreditcardMasker.java
This will mask the following credit cards: Visa, Mastercard, Amex, Diners, Discovery, JCB
/**
* This will mask a portion of a credit card with 'x' if it finds it in a sentence.
\b(?:
# Visa card number 4[\ -]*(?:\d[\ -]*){11}(?:(?:\d[\ -]*){3})?\d|
# MasterCard card number (?:5[\ -]*[1-5](?:[\ -]*\d){2}|(?:2[\
-]*){3}[1-9]|(?:2[\ -]*){2}[3-9][\ -]*\d|2[\ -]* [3-6](?:[\ -]*\d){2}|2[\
-]*7[\ -]*[01][\ -]*\d|2[\ -]*7[\ -]*2[\ -]*0)(?:[\ -]*\d){12}|
public List<EntityDate> findTodaysEntries() {
LocalDateTime now = LocalDateTime.now();
return entity.findByEntityDateBetween(now.with(LocalTime.MIN), now.with(LocalTime.MAX));
}
//Spring data retreive first 50 results with pageable;
public List<AnEntity> retrieveFirst50() {
Pageable pageable = new PageRequest(0, 50, Sort.Direction.DESC, "matchcode");
Page<AnEntity> all = anEntityRepository.findAll(pageable);