Skip to content

Instantly share code, notes, and snippets.

View miry's full-sized avatar

Michael Nikitochkin miry

View GitHub Profile
@hvoecking
hvoecking / translate.go
Last active March 28, 2024 13:52
Golang reflection: traversing arbitrary structures
// Traverses an arbitrary struct and translates all stings it encounters
//
// I haven't seen an example for reflection traversing an arbitrary struct, so
// I want to share this with you. If you encounter any bugs or want to see
// another example please comment.
//
// The MIT License (MIT)
//
// Copyright (c) 2014 Heye Vöcking
//
@miry
miry / Brewfile
Last active October 28, 2023 11:52
MacOS Brewfile to install default applications. https://github.com/Homebrew/homebrew-bundle
#cask_args appdir: "~/Applications", require_sha: true
cask 'spotify'
cask 'homebrew/cask-versions/firefox-developer-edition'
cask 'signal'
cask 'keybase'
cask 'slack'
cask 'telegram-desktop'
@miry
miry / 01_extract_crt.rb
Last active September 3, 2023 06:32
Extract certificate from the kubernetes config.
require 'optparse'
require 'yaml'
require 'base64'
options = {
config_path: File.join(ENV['HOME'], '.kube', 'config'),
write_dir: File.join(ENV['HOME'], '.kube')
}
OptionParser.new do |opts|
@xueshanf
xueshanf / extract_kubecfg_cert.sh
Last active February 13, 2023 13:45
Extract kubernetes cluster credentials from kubecfg
#!/bin/bash
# Input: ./extract_kubecfg_cert.sh my-cluster-name username
# Output: ./my-cluster-name-ca.crt ./username.crt ./username.key
# Exit on error
abort(){
echo $1 && exit 1
}
# Prerequistes
@miry
miry / MOVIE COMPRESSION.md
Last active December 19, 2022 18:04
Automate compressing of video files from GoPro
@zero-master
zero-master / GDPR.md
Last active February 14, 2022 20:07
Show visitors from EU countries a page with GDPR message using Cloudflare and .htaccess
@DrPsychick
DrPsychick / git-funcs.sh
Last active April 19, 2021 20:02
Simple bash functions to automate GitHub branches and pull requests
#!/bin/bash
# Workflow: create branch -> create pull request
# git-create-branch-push "issue X"
# -> make changes, commit and push
# github-branch-pr "fix: issue solved" "closes #x"
# -> creates new PR with title and body
#
# Workflow: create branch for issue -> create pull request
# github-issue-branch-push 10
@alunny
alunny / file-api-sample.js
Created April 14, 2010 18:41
sample usage of the phonegap file api
var writeData = function (filename, data, callback) {
var writeOutData = function () {
var fw = new FileWriter();
fw.oncomplete = callback;
fw.onerror = function () {
alert("Failed to save update");
}
fw.writeAsText("myDir/" + filename, data);
}
def method_one(&block)
puts "method_one"
block.call
end
def method_two(&block)
puts "method_two"
block.call
end