Skip to content

Instantly share code, notes, and snippets.

View Pictor13's full-sized avatar
🤹‍♂️
Juggling with curiosity

Igor Pellegrini Pictor13

🤹‍♂️
Juggling with curiosity
  • BerlinOnline Stadtportal GmbH & Co. KG
  • Berlin
View GitHub Profile
@customcommander
customcommander / spread-vs-assign.md
Last active December 18, 2023 11:13
On using assignment over spread to achieve performance

Spread vs assign

Abstract

In this article I compare the performance of the spread operator ... and the performance of the assignement operator = in the context of data transformation.

I show that using the spread operator isn't a trivial choice to make and I suggest that immutability and mutation don't have to be mutually exclusive. I also show how one-liner functions can be enriched with the comma operator ,.

What are we measuring?

@rbreaves
rbreaves / WaylandUbuntu19.10-AppTitle
Last active February 7, 2024 12:02
Grab wmclass name or Window Name/Title under Wayland with Gnome 3.x
# Single Command, runs 2 calls to gdbus to get the currently active Window from Gnome 3.x
# Escaped so you can copy and paste into terminal directly
gdbus call -e -d org.gnome.Shell -o /org/gnome/Shell -m org.gnome.Shell.Eval global.get_window_actors\(\)[`gdbus call -e -d org.gnome.Shell -o /org/gnome/Shell -m org.gnome.Shell.Eval global.get_window_actors\(\).findIndex\(a\=\>a.meta_window.has_focus\(\)===true\) | cut -d"'" -f 2`].get_meta_window\(\).get_wm_class\(\) | cut -d'"' -f 2
# Unescaped version, will not run
# Broken down into 2 commands.
# Call to Gnome to get the array location of the active Application
gdbus call -e -d org.gnome.Shell -o /org/gnome/Shell -m \
@akhenakh
akhenakh / mapd.nomad
Created November 11, 2019 22:01
Example Nomad deployment
job "mapd" {
datacenters = ["dc1"]
type = "service"
constraint {
operator = "distinct_hosts"
value = "true"
}
update {
max_parallel = 1
min_healthy_time = "10s"
@GiacomoP
GiacomoP / app.js
Last active September 2, 2019 12:33
M5S Rousseau - Admin Frontend app
(function(e) {
function t(t) {
for (var n, s, r = t[0], l = t[1], d = t[2], c = 0, m = []; c < r.length; c++) s = r[c], a[s] && m.push(a[s][0]), a[s] = 0;
for (n in l) Object.prototype.hasOwnProperty.call(l, n) && (e[n] = l[n]);
u && u(t);
while (m.length) m.shift()();
return o.push.apply(o, d || []), i()
}
function i() {
@borekb
borekb / README.md
Last active April 2, 2024 19:56
How to link to headings in GitHub issues and pull requests

How to link to headings in GitHub issues and pull requests

If you have an issue comment / PR description on GitHub, it doesn't automatically get anchors / IDs that you could link to:

Screenshot 2019-07-11 at 13

What I like to do is to add a visible # character like this:

Screenshot 2019-07-11 at 13 42 21

@elemongw
elemongw / forkstats.py
Last active December 17, 2022 11:30
Find most active forks of a project in GitHub. Sorts by most recently pushed
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Collect all forks of a github project and return the most recently pushed.
Any alternatives I could find searched only the most recent forks of a project,
which does not return accurate results for projects with many forks.
Note that the GitHub API has a rate limit of 60 requests per hour for unauthenticated requests.
You can create a personal access token in order to circumvent this, which will raise the limit
@a-r-m-i-n
a-r-m-i-n / Easy Admin Bundle ConfigPass.md
Last active May 27, 2020 13:11
This document describes the process of Symfony's Easy Admin Bundle, to process the given YAML configuration, with registered **ConfigPass** classes.

Easy Admin Bundle ConfigPass

This document describes the process of Symfony's Easy Admin Bundle, to process the given YAML configuration, with registered ConfigPass classes.

The problem

Those ConfigPasses are collections of private methods, which have e.g. action names hardcoded, so you can't reuse the "config auto-magic" for your new actions.

@dimabory
dimabory / gist:56e36474a1bb5573c08f26805a978fb5
Last active July 22, 2023 08:41
General Responsibility Assignment Software Patterns (GRASP)
@anwas
anwas / multiple-php.txt
Last active December 14, 2023 11:03
[Multiple PHP versions on Ubuntu] #php #dev #ispconfig
## Add repository
### https://launchpad.net/%7Eondrej/+archive/ubuntu/php
### https://launchpad.net/~ondrej/+archive/ubuntu/apache2
sudo add-apt-repository ppa:ondrej/php
sudo add-apt-repository ppa:ondrej/apache2
sudo apt-get update
sudo apt-get dist-upgrade
@DominicBreuker
DominicBreuker / iptables.md
Last active October 14, 2021 17:47
iptables firewall

iptables cheat sheet

Concepts

iptables defines tables, which group features:

  • filter: use it to filter traffic
  • nat: use it to implement NAT
  • raw: use it to define which connections iptables should track (stateful firewall)
  • mangle: use it to change some fields in packets (e.g., TTL)
  • security: use it to define access control