Skip to content

Instantly share code, notes, and snippets.

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

Serdar Akarca akarca

🏠
Working from home
View GitHub Profile
@vidakDK
vidakDK / pycurl.md
Last active November 2, 2023 03:06
Install `pycurl` on MacOS Big Sur 11.0.1

Introduction

Installing pycurl on MacOS with Python 3.6+ and newer proved to be tricky, especially since a lot of the available resources seem to be outdated ([1], [2], [3]).

This gist was last updated at 2020-12-31.

Steps:

  1. Remove previously installed Homebrew versions of curl:
    brew uninstall curl
@Piasy
Piasy / install_ffmpeg.sh
Last active April 14, 2024 05:40
brew install ffmpeg with all options
brew options ffmpeg
brew install ffmpeg \
--with-chromaprint \
--with-fdk-aac \
--with-fontconfig \
--with-freetype \
--with-frei0r \
--with-game-music-emu \
--with-libass \
@simme
simme / debounce-throttle.swift
Created December 20, 2016 10:04
Swift 3 debounce & throttle
//
// debounce-throttle.swift
//
// Created by Simon Ljungberg on 19/12/16.
// License: MIT
//
import Foundation
extension TimeInterval {
@dingzeyuli
dingzeyuli / copy
Created November 11, 2016 15:33
Faster and more efficient alternative to scp for file copying
#!/bin/sh
# whenever you use "scp", use "copy" instead, it ignores duplicate files.
rsync -azhe ssh --progress $1 $2
@toringe
toringe / cidr.py
Created October 22, 2015 10:28
Merge CIDR blocks into super blocks if possible
#!/usr/bin/env python
#
# Example 1: All blocks in list.txt, one CIDR per line
# cat list.txt | cidr.py
#
# Example 2: Echo CIDR blocks to stdout
# echo 1.2.3.0/25 1.2.3.128/25 | cidr.py
import sys
from netaddr import *
@britzl
britzl / timer.lua
Last active February 13, 2018 14:18
Timer module that can be used to get a callback when a certain amount of time has elapsed
--- Module that can be used to get a callback when a certain amount of time has elapsed
--
-- @usage
-- local timer = require "timer"
-- function init(self)
-- self.t1 = timer.seconds(2, function()
-- print("2 seconds have elapsed")
-- end)
-- self.t2 = timer.seconds(5, function()
-- print("5 seconds have elapsed")
@benjamincharity
benjamincharity / contacts.js
Last active January 9, 2023 16:06
Create a downloadable file of VCARD formatted address for iOS from a JSON array.
var contacts =
[
{
"notes": [
{
"description": "Fugiat aute pariatur excepteur elit."
}
],
"tels": [
{
@mrchrisadams
mrchrisadams / auto_activation.fish
Last active October 13, 2021 12:47
virtual environments with python and fish
################
# Automatic activation
if not set -q VIRTUALFISH_ACTIVATION_FILE
set -g VIRTUALFISH_ACTIVATION_FILE .venv
end
function __vfsupport_auto_activate --on-variable PWD
if status --is-command-substitution
return
@uupaa
uupaa / ios.xcode.md
Last active January 28, 2020 09:36
iOS device spec, versions and Xcode deployment target information

iOS Devices

Device CPU GPU Display OpenGL
iPod touch 4 A4 PowerVR SGX535 960 x 640 2.1
iPod touch 5 A5 PowerVR SGX543MP2 1136 x 640 2.1
iPad 1 A4 PowerVR SGX535 1024 x 768 2.1
iPad 2 A5 PowerVR SGX543MP2 1024 x 768 2.1
iPad 3 A5X PowerVR SGX543MP4 2048 x 1536 2.1
iPad 4 A6X PowerVR SGX554MP4 2048 x 1536 2.1
@jackiekazil
jackiekazil / rounding_decimals.md
Last active January 17, 2024 12:29
How do I round to 2 decimals in python?

How do I round to 2 decimals?

In python, you have floats and decimals that can be rounded. If you care about the accuracy of rounding, use decimal type. If you use floats, you will have issues with accuracy.

All the examples use demical types, except for the original value, which is automatically casted as a float.

To set the context of what we are working with, let's start with an original value.

Original Value