Skip to content

Instantly share code, notes, and snippets.

@drmalex07
drmalex07 / socat-forward-tcp4-to-tcp6.sh
Last active November 7, 2024 09:40
Tunnel TCP traffic via socat. #socat
#!/bin/bash
set -e
listen_iface=${1}
listen_port=${2}
target_host=${3}
target_port=${4}
# Check non-empty
[[ -n "${listen_iface}" ]]
package com.yourapp.navbar;
import android.app.Activity;
import android.view.View;
import com.facebook.react.ReactActivity;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
@dunossauro
dunossauro / singleton_example.py
Created March 15, 2018 02:16
singleton decorator python
# copied from:
# https://stackoverflow.com/questions/31875/is-there-a-simple-elegant-way-to-define-singletons
class Singleton:
"""
A non-thread-safe helper class to ease implementing singletons.
This should be used as a decorator -- not a metaclass -- to the
class that should be a singleton.
The decorated class can define one `__init__` function that
@tnolet
tnolet / puppeteer_youtube.js
Created February 23, 2018 18:17
Puppeteer search youtube
const puppeteer = require('puppeteer')
const screenshot = 'youtube_fm_dreams_video.png'
try {
const browser = await puppeteer.launch()
const page = await browser.newPage()
await page.goto('https://youtube.com')
await page.type('#search', 'Fleetwood Mac Dreams')
await page.click('button#search-icon-legacy')
await page.waitForSelector('ytd-thumbnail.ytd-video-renderer')
"detox": {
"configurations": {
"ios.sim.debug": {
"binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/PolideaSample.app",
"build": "xcodebuild -project ios/PolideaSample.xcodeproj -scheme PolideaSample -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build",
"type": "ios.simulator",
"name": "iPhone 6s Plus"
},
"android.emu.debug": {
"binaryPath": "android/app/build/outputs/apk/debug/app-debug.apk",
describe('Example', () => {
beforeEach(async () => {
await device.reloadReactNative();
await waitFor(element(by.id('ButtonText'))).toBeVisible().withTimeout(10000);
});
it('should Press me text be displayed', async () => {
await waitFor(element(by.text("Press Me"))).toBeVisible().withTimeout(100);
});
<Text
accessible= {true}
testID= {"ButtonText"}
accessibilityLabel= {"ButtonTextDesc"}
style={styles.textStyle}>
{!this.state.clicked? defaultButtonText: "Polidea"}
</Text>
@alextanhongpin
alextanhongpin / instructions.md
Last active August 15, 2024 14:54
Setting up locale on alpine:3.6 docker image

Locale

When using the alpine docker image, the command locale -a or locale-gen does not exist. You might need them to install different locales in your docker image to allow your applications to support multilingual. Most common issue is when dealing with database inputs (MySQL), whereby the text will be displayed as garbage characters if you do not have the right locale installed.

FROM alpine:3.6

# ---not shown here---
@gdamjan
gdamjan / ssl-check.py
Last active April 14, 2024 07:16
Python script to check on SSL certificates
# -*- encoding: utf-8 -*-
# requires a recent enough python with idna support in socket
# pyopenssl, cryptography and idna
from OpenSSL import SSL
from cryptography import x509
from cryptography.x509.oid import NameOID
import idna
from socket import socket
@cvgarciarea
cvgarciarea / head_tab_window.py
Last active July 18, 2024 08:14
A Gtk+ Window with a tabs on HeaderBar.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import gi
gi.require_versions({"Gtk": "3.0", "Gdk": "3.0"})
from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import GObject