Skip to content

Instantly share code, notes, and snippets.

View jimmytuc's full-sized avatar
💭
I may be slow to respond.

Foo jimmytuc

💭
I may be slow to respond.
  • Viet Nam
View GitHub Profile
@tuxfight3r
tuxfight3r / kcat.md
Last active December 4, 2023 22:10
KafkaCat configuration for AWS MSK

KafkaCat Configuration for AWS MSK

Set the below environment variable with the following values

NOTE: Kafkacat is renamed to kcat recently and the config variable should be KCAT_CONFIG for version 1.7 onwards.

# you can export the variable or present the config with -F parameter for kafkacat
export KAFKACAT_CONFIG=/home/tools/persistent/kcat/kafkacat_config

Contents of kafkacat configuration

@madsem
madsem / cd.yml
Last active October 12, 2024 17:51
GitHub Workflows For: Laravel CI with Mysql 8 & Laravel Vapor Deployment
name: Laravel Vapor CD
on:
release:
types: [ published, deleted ]
branches:
- master
jobs:
deploy_release:
runs-on: ubuntu-20.04
@shu-yusa
shu-yusa / create_jwt.sh
Last active September 9, 2024 08:35
Generate private and public keys, and create JWT and JWKs
#!/bin/sh
## Requires openssl, nodejs, jq
header='
{
"kid": "12345",
"alg": "RS256"
}'
payload='
{
"iss": "https://example.com",
@pgorod
pgorod / Import_script.php
Last active July 22, 2022 08:33
Sample Import_script for SuiteCRM, CSV to beans and relationships, and security groups
<?php
//xdebug_break();
if (!defined('sugarEntry') || !sugarEntry) die ('Not a Valid Entry Point!');
$date= new DateTime();
//chdir('/opt/bitnami/apps/suitecrm/htdocs/');
echo 'School Importer started at ';
echo $date->format('r').'<br>';
echo '-------------------------------------------------------------------------------------------------------------------------------------<br>';
@jimmytuc
jimmytuc / docker-cleanup-resources.md
Created April 4, 2018 04:41 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@Rotzke
Rotzke / asyncio.py
Last active October 1, 2023 02:25
Asyncio with semaphores
import random
import asyncio
from aiohttp import ClientSession
async def fetch(url, session):
async with session.get(url) as response:
delay = response.headers.get("DELAY")
date = response.headers.get("DATE")
print("{}:{} with delay {}".format(date, response.url, delay))
return await response.read()
@claudinei-daitx
claudinei-daitx / SparkSessionS3.scala
Created December 15, 2017 13:02
Create a Spark session optimized to work with Amazon S3.
import org.apache.spark.sql.SparkSession
object SparkSessionS3 {
//create a spark session with optimizations to work with Amazon S3.
def getSparkSession: SparkSession = {
val spark = SparkSession
.builder
.appName("my spark application name")
.config("spark.serializer", "org.apache.spark.serializer.KryoSerializer")
.config("spark.hadoop.fs.s3a.access.key", "my access key")
@prats226
prats226 / semantic_transfer_learning.py
Created January 31, 2017 10:01
Sentiment classification using transfer learning
import collections, math, random, numpy
import tensorflow as tf
from sklearn.cross_validation import train_test_split
sentences = """hated the movie it was stupid;\ni hated it so boring;\nawesome the movie was inspiring;\nhated it what a disaster;\nwe hated the movie they were idiotic;\nhe was stupid, hated her;\nstupid movie is boring;\ninspiring ourselves, awesome;\ninspiring me, brilliant;\nwe hated it they were rubbish;\nany inspiring movie is amazing;\nit was stupid what a disaster;\nits stupid, rubbish;\nstupid, idiotic!;\nawesome great movie;\nboring, must be hated;\nhe was boring the movie was stupid;\nboring movie was a disaster;\nboth boring and rubbish;\nso boring and idiotic;\ngreat to amazing;\ndisaster, more than hated;\nbetween disaster and stupid;\ndisaster, so boring;\nawesome movie, brilliant;\ntoo awesome she was amazing;\nhe was brilliant loved it;\ndisaster, only idiotic;\nrubbish movie hated him;\nit was rubbish, why so stupid?;\nrubbish, too boring;\nrubbish, disaster!;\nrubbish, very
@sjpuas
sjpuas / docker-compose.yml
Created January 12, 2017 23:48
docker-compose v2.1 healthcheck and service_healthy
version: '2.1'
services:
web:
image: nginx:alpine
depends_on:
db:
condition: service_healthy
db:
image: redis:alpine
healthcheck:
@AtulKsol
AtulKsol / psql-error-fix.md
Last active November 13, 2024 12:43
Solution of psql: FATAL: Peer authentication failed for user “postgres” (or any user)

psql: FATAL: Peer authentication failed for user “postgres” (or any user)

The connection failed because by default psql connects over UNIX sockets using peer authentication, that requires the current UNIX user to have the same user name as psql. So you will have to create the UNIX user postgres and then login as postgres or use sudo -u postgres psql database-name for accessing the database (and psql should not ask for a password).

If you cannot or do not want to create the UNIX user, like if you just want to connect to your database for ad hoc queries, forcing a socket connection using psql --host=localhost --dbname=database-name --username=postgres (as pointed out by @meyerson answer) will solve your immediate problem.

But if you intend to force password authentication over Unix sockets instead of the peer method, try changing the following pg_hba.conf* line:

from