Skip to content

Instantly share code, notes, and snippets.

View coraxster's full-sized avatar
💭
Oh my code!

dmitry kuzmin coraxster

💭
Oh my code!
View GitHub Profile
@coraxster
coraxster / CiscoAnyConnectVPNauto.scpt
Last active January 25, 2021 08:46
update for AnyConnect 4.*
-- 1. Create a new password entry in Keychain Access called "ExnessLDAP" with your ldap password
-- 2. Create a new password entry in Keychain Access called "Exness2Factor" with your 2factor token
-- 3. Install oath-toolkit. (brew install oath-toolkit)
-- 4. Open this script in Script Editor (both this and the above are in the Applications->Utilities folder) and "Save as.." an Application (.app) with desired name.
-- 5. Open Security & Privacy System Preferences, go to Privacy, Accessibility.
-- 6. Enable the above .app so it can access Accessibility
-- 7. Add the new .app to /Users/[yourshortname]/Applications with a shortcut to your Dock
-- 8. Enjoy the fast connection with no need to enter password and increased security of not having a sensitive password stored as plain text.
set targetApp to "Cisco AnyConnect Secure Mobility Client"
@rousan
rousan / evaluation-order.md
Last active June 4, 2018 21:25
Evaluation order of assignment operator in GoLang

Evaluation order of assignment operator in GoLang

In GoLang, the evaluation order of assignment operator is straight forward.

The order is:

  1. Evaluate the lvalues to Memory Location from left to right.
  2. Evaluate the rvalues to constant values from left to right.
  3. And finallly, assign rvalues to lvalues from left to right.

The POC:

@sovchinn
sovchinn / .gitlab-ci.yaml
Last active May 26, 2024 17:46
golang scratch docker builder - gitlab ci yaml
# Review and update variables in each stage as needed
# Pipeline uses gitlab k8 integration and a couple of custom containers
## The code is based on the gitlab autodevops yaml
# The pipeline builds two docker images
## First image is for development using Ubuntu as base (so you can debug inside the container)
## Second image is for production built from scratch
# Currently only the dev stage is deployed
cache:
untracked: true
@alexmcroberts
alexmcroberts / main.go
Last active February 17, 2022 11:52
Golang unmarshal JSON epoch in milliseconds from string to time.Time
package main
import (
"encoding/json"
"fmt"
"strconv"
"strings"
"time"
)
@jwage
jwage / .php_cs
Last active April 14, 2025 19:32
php-cs-fixer git pre commit hook
<?php
return Symfony\CS\Config\Config::create()
->level(Symfony\CS\FixerInterface::SYMFONY_LEVEL)
->fixers([
'short_array_syntax',
'ordered_use',
])
;
@davidvthecoder
davidvthecoder / round.go
Created April 9, 2014 19:58
Arggh Golang does not include a round function in the standard math package. So I wrote a quick one.
package main
import (
"log"
"math"
)
func Round(val float64, roundOn float64, places int ) (newVal float64) {
var round float64
pow := math.Pow(10, float64(places))
@vladqa
vladqa / yii-clear-table-cache.php
Created January 11, 2014 21:43
Clear Yii table schema cache
// Load all tables of the application in the schema
Yii::app()->db->schema->getTables();
// clear the cache of all loaded tables
Yii::app()->db->schema->refresh();
@nikic
nikic / objects_arrays.md
Last active May 16, 2025 22:07
Post explaining why objects often use less memory than arrays (in PHP)

Why objects (usually) use less memory than arrays in PHP

This is just a small post in response to [this tweet][tweet] by Julien Pauli (who by the way is the release manager for PHP 5.5). In the tweet he claims that objects use more memory than arrays in PHP. Even though it can be like that, it's not true in most cases. (Note: This only applies to PHP 5.4 or newer.)

The reason why it's easy to assume that objects are larger than arrays is because objects can be seen as an array of properties and a bit of additional information (like the class it belongs to). And as array + additional info > array it obviously follows that objects are larger. The thing is that in most cases PHP can optimize the array part of it away. So how does that work?

The key here is that objects usually have a predefined set of keys, whereas arrays don't:

@jboner
jboner / latency.txt
Last active December 12, 2025 04:24
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD