Skip to content

Instantly share code, notes, and snippets.

Avatar

Gopalakrishna Palem KrishnaPG

View GitHub Profile
@AlexeyKupershtokh
AlexeyKupershtokh / dump.sql
Last active Jun 28, 2021
Postgres DDL to Clickhouse converter
View dump.sql
select
concat(
'create table ',
table_name,
'(',
string_agg(
concat(
column_name,
' ',
CASE when is_nullable = 'YES' THEN 'Nullable(' END,
@bradtraversy
bradtraversy / docker_wordpress.md
Last active Sep 17, 2021
Docker Compose FIle For Wordpress, MySQL & phpmyadmin
View docker_wordpress.md

Wordpress & Docker

This file will setup Wordpress, MySQL & PHPMyAdmin with a single command. Add the code below to a file called "docker-compose.yaml" and run the command

$ docker-compose up -d

# To Tear Down
$ docker-compose down --volumes
@ruanbekker
ruanbekker / setup-kubernetes-ubuntu-16.md
Last active Aug 21, 2021
Install a 3 Node Kubernetes Cluster on Ubuntu 16
View setup-kubernetes-ubuntu-16.md

Master: Dependencies

apt update && apt upgrade -y
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -

cat <<EOF > /etc/apt/sources.list.d/kubernetes.list
deb http://apt.kubernetes.io/ kubernetes-xenial main
EOF
anonymous
anonymous / chart.vue
Created May 29, 2017
Vue.js + C3.js
View chart.vue
<script>
import { debounce, cloneDeep, defaultsDeep } from 'lodash'
import c3 from 'c3'
require('c3/c3.css')
export default {
name: 'c3-chart',
props: {
config: {
@donmccurdy
donmccurdy / wildcard-to-regexp.js
Last active Aug 30, 2021
Wildcard and glob matching in JavaScript.
View wildcard-to-regexp.js
/**
* Creates a RegExp from the given string, converting asterisks to .* expressions,
* and escaping all other characters.
*/
function wildcardToRegExp (s) {
return new RegExp('^' + s.split(/\*+/).map(regExpEscape).join('.*') + '$');
}
/**
* RegExp-escapes all characters in the given string.
@alexey-milovidov
alexey-milovidov / nested.txt
Created Jun 17, 2016
Example of Nested data type in ClickHouse.
View nested.txt
:) CREATE TABLE test.nested (EventDate Date, UserID UInt64, Attrs Nested(Key String, Value String)) ENGINE = MergeTree(EventDate, UserID, 8192)
CREATE TABLE test.nested
(
EventDate Date,
UserID UInt64,
Attrs Nested(
Key String,
Value String)
) ENGINE = MergeTree(EventDate, UserID, 8192)
@application2000
application2000 / how-to-install-latest-gcc-on-ubuntu-lts.txt
Last active Sep 21, 2021
How to install latest gcc on Ubuntu LTS (12.04, 14.04, 16.04)
View how-to-install-latest-gcc-on-ubuntu-lts.txt
These commands are based on a askubuntu answer http://askubuntu.com/a/581497
To install gcc-6 (gcc-6.1.1), I had to do more stuff as shown below.
USE THOSE COMMANDS AT YOUR OWN RISK. I SHALL NOT BE RESPONSIBLE FOR ANYTHING.
ABSOLUTELY NO WARRANTY.
If you are still reading let's carry on with the code.
sudo apt-get update && \
sudo apt-get install build-essential software-properties-common -y && \
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
@dmajda
dmajda / indentation-based.pegjs
Created Nov 27, 2015
Simple intentation-based language PEG.js grammar
View indentation-based.pegjs
/*
* Simple Intentation-Based Language PEG.js Grammar
* ================================================
*
* Describes a simple indentation-based language. A program in this language is
* a possibly empty list of the following statements:
*
* * S (simple)
*
* Consists of the letter "S".
@zlumer
zlumer / dot_preload.js
Last active Apr 24, 2016
doT template preloader for browser
View dot_preload.js
(function (doT) {
var templates = {};
var scripts = Array.prototype.slice.call(document.getElementsByTagName('script')); // load all scripts
for (var i = 0; i < scripts.length; i++) { // filter out template script tags
var script = scripts[i];
if (script.type == "text/dot-template") {
var name = script.id || script.getAttribute('name') || script.getAttribute('data-name');
templates[name] = script.innerHTML; // store template for later use
script.parentNode.removeChild(script); // remove template from DOM
}
@domenic
domenic / 0-github-actions.md
Last active Sep 24, 2021
Auto-deploying built products to gh-pages with Travis
View 0-github-actions.md

Auto-deploying built products to gh-pages with GitHub Actions

This is a set up for projects which want to check in only their source files, but have their gh-pages branch automatically updated with some compiled output every time they push.

A file below this one contains the steps for doing this with Travis CI. However, these days I recommend GitHub Actions, for the following reasons:

  • It is much easier and requires less steps, because you are already authenticated with GitHub, so you don't need to share secret keys across services like you do when coordinate Travis CI and GitHub.
  • It is free, with no quotas.
  • Anecdotally, builds are much faster with GitHub Actions than with Travis CI, especially in terms of time spent waiting for a builder.