Skip to content

Instantly share code, notes, and snippets.

View jimfilippou's full-sized avatar
:shipit:

Dimitrios Filippou jimfilippou

:shipit:
View GitHub Profile
- name: Install Docker (including compose)
hosts: all
become: true
tasks:
- name: Update apt cache
apt:
update_cache: yes
- name: Install dependencies via apt
all: windows-amd64 macos-arm64
windows-amd64:
mkdir -p dist
GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CXX=x86_64-w64-mingw32-g++ CC=x86_64-w64-mingw32-gcc go build -o dist/main-windows-amd64.exe main.go
macos-arm64:
GOOS=darwin GOARCH=arm64 go build -o dist/main-macos-arm64 main.go
clean:
/**
* TODO: Write
* @param message
* @returns
*/
export default function Confirmable(message: string) {
return function (target: Object, key: string | symbol, descriptor: PropertyDescriptor) {
const original = descriptor.value;
descriptor.value = function (...args: any[]) {
const allow = confirm(message);
@import url(https://fonts.googleapis.com/css?family=Open+Sans:300i,400,700);
body, table {
padding:50px;
font:14px/1.5 'Open Sans', "Helvetica Neue", Helvetica, Arial, sans-serif;
color:#555;
font-weight:300;
margin-left: auto;
margin-right: auto;
max-width: 1440px;
interface Virus {
public fun mutate()
public fun spread() {
println("Spreading the virus...")
}
}
class CoronaVirus: Virus {
override fun mutate() {
println("Mutating the corona virus...")
@jimfilippou
jimfilippou / ds.sh
Created February 12, 2020 11:25
Removes all .DS_Store files from the working directory
# Removes all .DS_Store files from the working directory
find . -name ".DS_Store" -delete
@jimfilippou
jimfilippou / ipv4.go
Created December 28, 2019 17:40
Returns IPv4 address iterating through all interfaces
func externalIP() (string, error) {
ifaces, err := net.Interfaces()
if err != nil {
return "", err
}
for _, iface := range ifaces {
if iface.Flags&net.FlagUp == 0 {
continue // interface down
}
if iface.Flags&net.FlagLoopback != 0 {
@jimfilippou
jimfilippou / whatismyip.sh
Created April 4, 2019 17:28
Easily find your IP on a Mac 💻
ifconfig | grep "inet " | grep -v 127.0.0.1 | awk '{print $2}'
@jimfilippou
jimfilippou / rename.py
Created February 6, 2018 21:17
Convert all PNGs to JPGs in current directory faaaaaaaast
import os
if __name__ == '__main__':
for subdir, dirs, files in os.walk(os.getcwd()):
for file in files:
x = os.path.join(subdir, file)
if x.endswith("png"):
# Convert image
print "Converting {}".format(x)
@jimfilippou
jimfilippou / rename.sh
Created October 20, 2017 18:53
Renames all files within directory
for file in *.html; do mv "$file" "${file/.html/.php}"; done