Skip to content

Instantly share code, notes, and snippets.

View celikelozdinc's full-sized avatar
🏠
Working from home

celikelozdinc celikelozdinc

🏠
Working from home
View GitHub Profile
@prathabk
prathabk / err.go
Created September 8, 2020 13:43
Decorating Go Error
package main
import (
"fmt"
"github.com/nicksnyder/go-i18n/v2/i18n"
"golang.org/x/text/language"
"strings"
)
func main() {
class Student:
def __init__(self, first_name, last_name):
self.first_name = first_name
self.last_name = last_name
def begin_study(self):
print(f"{self.first_name} {self.last_name} begins studying.")
@classmethod
def from_dict(cls, name_info):
@hughesadam87
hughesadam87 / fib.py
Last active August 20, 2020 09:46
Fibonacci Python (memoized and unmemoized)
""" Python implementation of recursive fib with/without memoization and bottom up (with pytests) """
def fib(n):
assert n >= 0, f"n was negative ({n})"
# Base cases
if n in [0, 1]:
return n
return fib(n - 1) + fib(n - 2)
@Xantios
Xantios / ubuntu_nic_netplan.md
Last active March 22, 2024 13:13
Ubuntu 20.04 Network setup with NetPlan and NetworkManager

Whut?!

Ubuntu 18.10 and onwards use netplan for the configuration of network interfaces. although im fine with it, it seems Cockpit and some other software dont like it as much.

Solution

Let Netplan configure the interface and hand-off further managent to NetworkManager.

notice: NetworkManager is not a X Application, although the name might sound like one.

@dbkinghorn
dbkinghorn / netplan2NM.sh
Created June 23, 2020 17:07
Change Ubuntu 20.04 server netplan to use NetworkManager instead of networkd
#!/usr/bin/env bash
# netplan2NM.sh
# Ubuntu server 20.04 Change from netplan to NetworkManager for all interfaces
echo 'Changing netplan to NetowrkManager on all interfaces'
# backup existing yaml file
cd /etc/netplan
cp 01-netcfg.yaml 01-netcfg.yaml.BAK
@beached
beached / C++ normal operators.md
Last active January 31, 2026 17:35
A list of the normal signatures of C++ operators that allow overloading

C++ Operator Signatures

This is a list of C++ operators that can be overloaded and their normal signatures(a.k.a what an int would do). The order is the preffered order to use them(The first one listed is often preffered)

Arithmetic

operator+ addition

  • free function -> T operator+( T const & lhs, T const & rhs )
  • member function -> T operator+( T const & rhs ) const

operator+ unary plus

  • member function -> T operator+( ) const
@flaviocopes
flaviocopes / check-substring-starts-with.go
Last active June 23, 2024 09:05
Go: check if a string starts with a substring #golang
package main
import (
"strings"
)
func main() {
strings.HasPrefix("foobar", "foo") // true
}