Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
CIPHERS='ALL:eNULL'
DELAY=${2:-0.1}
SERVER=${1:?usage: $0 <host:port> [delay, default is ${DELAY}s] [ciphers, default is ${CIPHERS}]}
MAXLEN=$(openssl ciphers "$CIPHERS" | sed -e 's/:/\n/g' | awk '{ if ( length > L ) { L=length} }END{ print L}')
echo Using $(openssl version).
declare -A TLSMAP=( [tls1_1]=cipher [tls1_2]=cipher [tls1_3]=ciphersuites )
@rponte
rponte / Lock.java
Created February 26, 2016 16:49
Concurrency Control for CDI (Interceptor and ReentrantReadWriteLock example)
@Inherited
@InterceptorBinding
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD,ElementType.TYPE})
public @interface Lock {
LockType value() default LockType.WRITE;
}
@mencargo
mencargo / postgresql.md
Last active April 19, 2024 07:22
PostgreSQL Queries

Useful PostgreSQL Queries & Commands

All sizes in MB, change /1024/1024 to /1024/1024/1024 for GB.

Databases sizes

Without system databases

select
datname as database,
(pg_database_size(datname)/1024/1024) as size
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active April 19, 2024 07:21
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@ipepe
ipepe / install-chrome-headless.sh
Last active April 19, 2024 07:15
Installing headless chrome on Ubuntu.
#!/bin/bash
# from https://chromium.woolyss.com/
# and https://gist.github.com/addyosmani/5336747
# and https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md
sudo apt-get update
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:canonical-chromium-builds/stage
sudo apt-get update
sudo apt-get install chromium-browser
chromium-browser --headless --no-sandbox http://example.org/
@FedericoTartarini
FedericoTartarini / commands_docusaurus_translation.md
Created March 28, 2021 06:10
Source code for the YouTube video - Translate a Docusaurus website in multiple languages with its internationalization (i18n) support.

Initialize a new site

with npx @docusaurus/init@latest init website classic

Configure your site

i18n: {
    defaultLocale: 'en',
    locales: ['en', 'it'],
    localeConfigs: {
      en: {
@nandorojo
nandorojo / DraggableScrollView.tsx
Last active April 19, 2024 07:12
Make a horizontal `ScrollView` draggable with a mouse (`react-native-web`)
import React, { ComponentProps } from 'react'
import { ScrollView } from 'react-native'
import { useDraggableScroll } from './use-draggable-scroll'
export const DraggableScrollView = React.forwardRef<
ScrollView,
ComponentProps<typeof ScrollView>
>(function DraggableScrollView(props, ref) {
const { refs } = useDraggableScroll<ScrollView>({
outerRef: ref,

I've recently joined Amazon Dublin from India and got opportunities to interview with Meta London, Zalando Berlin & some other companies. I extensively researched about companies hiring internationally which support visa & relocation for Tech roles. So sharing list of companies:

Do consider to STAR, if it helped you.

London

@azwdevops
azwdevops / gist:5995cac82aa31606f612960d17f0de53
Created April 19, 2024 07:06
An SQL gist to create company table and run various queries to extract data from MYSQL DB
CREATE DATABASE company_db;
USE company_db;
-- CREATE TABLES
CREATE TABLE employee(
emp_id INT PRIMARY KEY,
first_name VARCHAR(20),
last_name VARCHAR(20),
birth_date DATE,
sex VARCHAR(1),
salary INT,
@mattiasghodsian
mattiasghodsian / readme.md
Created May 10, 2021 16:53
Setup RAIDZ on Ubuntu Server 20.04 LTS

Setup RAIDZ on Ubuntu Server 20.04 LTS

In this walkthrough we'll be using 4 brand new Seagate IronWolf Pro 10TB 7200rpm 256MB hard drives to setup a ZFS storage pool (RAIDZ 10).

1. ZFS

If you don't have ZFS already installed go ahead and run

sudo apt install zfsutils-linux

2. Disk Identifier & Sector sizes

Before we do anything with the drives we need the disk identifier and sector size for each drive for step 3.