Skip to content

Instantly share code, notes, and snippets.

View nofate's full-sized avatar

Michael Gamov nofate

  • Virtual Minds
  • Germany
View GitHub Profile
@nofate
nofate / xmas-tree.py
Created December 16, 2021 03:38
🎄 My X-mas tree code golf entry 🎄
import random, time
b = '🔴🟡🔵'
c = '123🎄'
s = '🌟⭐'
o = "\033[2J"
p = " " * 18
print(o)
t = p + "*\n" + "\n".join(["".join([' ' * (20 - i - j), *random.choices(c, [1, 1, 1, 28], k=j + i)]) for i in range(5) for j in range(1, 4 + i)] + [p + "🟫"])
while 1:
s = s[::-1]
{
"continent": {
"code": "EU",
"names": {
"de": "Europa",
"ru": "Европа",
"pt-BR": "Europa",
"ja": "ヨーロッパ",
"en": "Europe",
"fr": "Europe",
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/env runhaskell
import Control.Monad.Trans.State
import Control.Monad.Trans.Writer
import Data.Foldable (toList)
import qualified Data.IntSet as IntSet
import Data.List as List
import qualified Data.Map as Map
import Data.Monoid
import Data.Ord

New project

stack new my-project
cd my-project
stack setup
stack build
stack exec my-project-exe
public static List<Integer> qs1(List<Integer> a) {
if (a.size() < 2) return a;
Integer pivotVal = a.get(a.size() / 2);
ArrayList<Integer> r = new ArrayList<>();
r.addAll(qs1(a.stream().filter(x -> x < pivotVal).collect(Collectors.toList())));
r.addAll(a.stream().filter(x -> x == pivotVal).collect(Collectors.toList()));
r.addAll(qs1(a.stream().filter(x -> x > pivotVal).collect(Collectors.toList())));
return r;

Jenkins common environment variables

Job

  • JOB_NAME - unique job name, e.g.: p-devel-snaphot
  • JOB_URL, e.g.: http://jenkins.example.com/job/p-devel-snaphot/10/

Build

  • BUILD_ID - sequential build number, e.g.: 10
@nofate
nofate / pg_trees.sql
Created July 14, 2015 17:05
Recursive tree traversal in PgSQL
WITH RECURSIVE folder_tree AS
(
SELECT
folder_id, folder_name, parent_id, cast(folder_name as character varying(2048)) as full_path
FROM
p_folder
WHERE
parent_id IS NULL
UNION ALL