Skip to content

Instantly share code, notes, and snippets.

View GoranLilja's full-sized avatar

Göran Lilja GoranLilja

  • Freelance software engineer
  • Växjö, Sweden
View GitHub Profile
import network
import socket
import time
import struct
from machine import Pin
NTP_DELTA = 2208988800
host = "pool.ntp.org"
@GoranLilja
GoranLilja / .zshenv
Last active December 28, 2021 21:15
MacBook setup
# Open application (or file with application)
alias vscode='open -a "Visual Studio Code"'
# Shortcut for editing this file
alias envedit='vscode /Users/goranlilja/.zshenv'
# Hide/show desktop icons
alias hideicons='defaults write com.apple.finder CreateDesktop false; killall Finder'
alias showicons='defaults write com.apple.finder CreateDesktop true; killall Finder'
# Jump directly to directories
alias code='cd ~/Code'
# Delete Xcode's Derived Data folder
@amittkashyap
amittkashyap / Persons.swift
Last active March 28, 2020 14:02
In this gist I will show you how to use custom keyDecodingStrategy/keyEncodingStrategy in new Codable/Decodable protocols in swift 4.1 with a simple example.
let json = """
[
{
"first-Name": "Taylor",
"last-Name": "swift",
"age": 28
},
{
"first-Name": "Tom",
"last-Name": "hanks",
@shashankmehta
shashankmehta / setup.md
Last active January 7, 2024 11:57
Setup PHP and Composer on OSX via Brew

First install Brew on your MAC

  • Setup Brew: ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • brew update
  • brew tap homebrew/dupes
  • brew tap homebrew/php
  • Install PHP 7.0.+ brew install php70
  • Install mcrypt: brew install mcrypt php70-mcrypt
  • Finally, install composer: brew install composer
@stephenhardy
stephenhardy / git-clearHistory
Created April 26, 2013 22:14
Steps to clear out the history of a git/github repository
-- Remove the history from
rm -rf .git
-- recreate the repos from the current content only
git init
git add .
git commit -m "Initial commit"
-- push to the github remote repos ensuring you overwrite history
git remote add origin git@github.com:<YOUR ACCOUNT>/<YOUR REPOS>.git