Skip to content

Instantly share code, notes, and snippets.

@iamnimnul
iamnimnul / copy_table.py
Created Aug 28, 2020 — forked from pawl/copy_table.py
Copy Schema Of A Remote Database Table To A New Local Table With SQLalchemy
View copy_table.py
from sqlalchemy import create_engine, Table, Column, Integer, Unicode, MetaData, String, Text, update, and_, select, func, types
# create engine, reflect existing columns, and create table object for oldTable
srcEngine = create_engine('mysql+mysqldb://username:password@111.111.111.111/database') # change this for your source database
srcEngine._metadata = MetaData(bind=srcEngine)
srcEngine._metadata.reflect(srcEngine) # get columns from existing table
srcTable = Table('oldTable', srcEngine._metadata)
# create engine and table object for newTable
destEngine = create_engine('mysql+mysqldb://username:password@localhost/database') # change this for your destination database
@iamnimnul
iamnimnul / PrivateRoute.jsx
Created Nov 5, 2019
PrivateRoute in react 16.11 react-router 5.1
View PrivateRoute.jsx
function PrivateRoute({component: Component, isAuthenticated: isAuthenticated, ...rest}) {
return (
<Route
{...rest}
render={props => isAuthenticated ? (<Component {...props} />) : (<Redirect to={{pathname: "/login"}} />)}
/>
);
}
@iamnimnul
iamnimnul / ioncube_loader_lin64_7.1_10.3.5_190429.so
Last active Apr 29, 2019
php 7.1 - ioncube loader - alpine linux 64bit
@iamnimnul
iamnimnul / ekg-password-recovery.sh
Created Mar 14, 2019
eksperymentalny klient gadu-gadu ekg - odzyskiwanie hasła
View ekg-password-recovery.sh
grep '^password ' .gg/config | cut -b 11- | base64 -d; echo
@iamnimnul
iamnimnul / ErrorFocus.jsx
Last active Jan 8, 2019 — forked from dphrag/ErrorFocus.jsx
Formik Scroll To First Invalid Element W/O Refs
View ErrorFocus.jsx
import React from 'react';
import { connect } from 'formik';
class ErrorFocus extends React.Component {
componentDidUpdate(prevProps) {
const { isSubmitting, isValidating, errors } = prevProps.formik;
const keys = Object.keys(errors);
if (keys.length > 0 && isSubmitting && !isValidating) {
const selector = `[name="${keys[0]}"]`;
const errorElement = document.querySelector(selector);
View Install Chrome, ChromeDriver and Selenium on Ubuntu 16.04
#!/usr/bin/env bash
# https://developers.supportbee.com/blog/setting-up-cucumber-to-run-with-Chrome-on-Linux/
# https://gist.github.com/curtismcmullan/7be1a8c1c841a9d8db2c
# http://stackoverflow.com/questions/10792403/how-do-i-get-chrome-working-with-selenium-using-php-webdriver
# http://stackoverflow.com/questions/26133486/how-to-specify-binary-path-for-remote-chromedriver-in-codeception
# http://stackoverflow.com/questions/40262682/how-to-run-selenium-3-x-with-chrome-driver-through-terminal
# http://askubuntu.com/questions/760085/how-do-you-install-google-chrome-on-ubuntu-16-04
# Versions
@iamnimnul
iamnimnul / JIRA Rapid Board points
Last active Apr 3, 2018
JIRA Rapid Board - table header with sum of points in the column (bookmarklet)
View JIRA Rapid Board points
javascript:(function () {
jQuery('.ghx-column-headers li').each(function (index) {
var pointsSum = 0;
jQuery('.ghx-columns li').eq(index).find(".aui-badge[title='Story Points']").each(function (index) {
pointsSum += parseInt(jQuery(this).text());
});
var span = jQuery('<span>(' + pointsSum + ')</span>');
span.css({'display': 'inline-block', 'right': 0, 'position': 'absolute'});
jQuery(this).append(span);
});