Skip to content

Instantly share code, notes, and snippets.

View eguven's full-sized avatar

Eren Güven eguven

View GitHub Profile
@eguven
eguven / csgo_convars.md
Last active May 6, 2024 14:38
List of CS:GO Cvars

Generated from List of CS:GO Cvars on 2020-12-07.

Protocol version 13752 [1105/1105]
Exe version 1.37.5.2 (csgo)
Exe build: 16:34:06 May 7 2020 (7852) (730)

1941 convars total.
@eguven
eguven / .bash_sourced_k8s.sh
Created January 23, 2020 16:38
Shell functions to quickly show and switch kubernetes contexts.
function k-enabled() {
if [ ! -z "$PS1_LAST" ]; then
return 0
fi
return 1
}
# show current context
function k-on() {
if k-enabled; then
@eguven
eguven / example.py
Created October 8, 2019 15:18
Example for changing python module scope
import importlib
m = importlib.import_module('mypackage.mymodule')
def foo():
return 42
m.foo = foo
@eguven
eguven / cleanup_ecr.py
Created August 9, 2019 18:27
Cleanup ECR by deleting old images
#!/usr/bin/env python
# Clean up tagged/untagged ECR images by age
# You need to set AWS_DEFAULT_REGION environment variable if you're deleting from an ECR
# repository outside your configured default region
#
# python cleanup_ecr.py --registry-id 123456789000 --repository-name ecr-foobar \
# --untagged-age 1 --tagged-age 30 --dry-run
import argparse
@eguven
eguven / logging_default.py
Last active December 15, 2020 17:21
logging default
import logging
# more verbose %(asctime)s %(levelname)s [%(module)s.%(funcName)s():%(lineno)d] %(message)s
logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s')
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
@eguven
eguven / main.rs
Created July 13, 2018 12:58
Playing with boxes, rust, kiss3d
extern crate kiss3d;
extern crate nalgebra;
extern crate rand;
extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate serde_json;
use kiss3d::camera::ArcBall;
use kiss3d::scene::SceneNode;
@eguven
eguven / main.rs
Created February 11, 2018 01:05
rendering cubes on a coordinate system from json
extern crate kiss3d;
extern crate nalgebra;
extern crate rand;
extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate serde_json;
use kiss3d::camera::ArcBall;
use kiss3d::scene::SceneNode;
@eguven
eguven / mobai_gamestate_full.json
Created October 23, 2016 22:08
an example gamestate json from mobai
{
"player_id": 0,
"turn": 0,
"map": [
[{
"occupants": [{
"target": null,
"hit": 1,
"posy": 0,
"type": "Fort",
@eguven
eguven / brew-list.sh
Last active November 16, 2024 19:55
List all packages installed using Homebrew and their sizes
# this original one uses values returned from 'brew info'
brew list --formula | xargs -n1 -P8 -I {} \
sh -c "brew info {} | egrep '[0-9]* files, ' | sed 's/^.*[0-9]* files, \(.*\)).*$/{} \1/'" | \
sort -h -r -k2 - | column -t
# faster alternative using 'du'
du -sch $(brew --cellar)/*/* | sed "s|$(brew --cellar)/\([^/]*\)/.*|\1|" | sort -k1h
@eguven
eguven / echo.py
Created February 10, 2015 10:52
asyncore echo
import asyncore
import socket
import sys
class EchoHandler(asyncore.dispatcher_with_send):
def handle_read(self):
data = self.recv(8192)
if data:
self.send(data)