Skip to content

Instantly share code, notes, and snippets.

View roustem's full-sized avatar

Roustem Karimov roustem

View GitHub Profile
#include <stdio.h> // for fprintf, stderr, perror
#include <stdlib.h> // for exit() and EXIT_FAILURE
#include <errno.h> // for errno
#include <fts.h> // for fts
int main(int argc, const char *argv[]) {
char * const paths[] = {"/tmp", NULL};
FTS *tree = fts_open(paths, FTS_COMFOLLOW|FTS_NOCHDIR, NULL);
if (!tree) {
@roustem
roustem / vm-setup.sh
Last active August 29, 2015 14:16 — forked from nf/vm-setup.sh
#!/bin/bash -e
echo '
PATH=$HOME/go/bin:$PATH
export GOPATH=$HOME
export CDPATH=.:$HOME/src/golang.org/x:$HOME/go/src:$HOME/src/github.com:$HOME/src/github.com/nf:$HOME/src/github.com/adg
export EDITOR=vim
' >> ~/.profile
sudo apt-get update
{
"always_show_minimap_viewport": true,
"binary_file_patterns":
[
"*.d.ts"
],
"color_scheme": "Packages/Tomorrow Color Schemes/Tomorrow.tmTheme",
"detect_indentation": false,
"draw_minimap_border": true,
"folder_exclude_patterns":
@roustem
roustem / gist:3664276aed9fb7e8fc4d
Last active August 29, 2015 14:20
Sublime Text Key Bindings
[
{
"keys" : ["cmd+>"],
"command" : "nextBuildError"
},
{
"keys" : ["cmd+<"],
"command" : "prevBuildError"
},
@roustem
roustem / TypeScript.sublime-settings
Last active August 29, 2015 14:20
Packages/User/TypeScript.sublime-settings
{
"translate_spaces_to_tabs": true,
"translate_tabs_to_spaces": false,
"use_tab_stops": true
}
@roustem
roustem / mysql-foreign-keys-deadlock.sql
Last active February 19, 2023 23:00
MySQL Foreign Keys Deadlock
--
-- This example shows how bad MySQL is when handling foreign key locks.
-- Deadlock happens when multiple transactions are inserting child records
-- pointing to the same parent and then try to update the parent record.
--
-- The solution is to always try to update the parent record first
-- but it could be hard to track the when database schema is more complex.
--
-- Based on: https://bugs.mysql.com/bug.php?id=48652
--
@roustem
roustem / Terraform-Blue-Green-AWS.md
Created October 9, 2015 06:20 — forked from ryan0x44/Terraform-Blue-Green-AWS.md
Blue-Green AWS Auto Scaling Deployments with Terraform

A quick note on how I'm currently handling Blue/Green or A/B deployments with Terraform and AWS EC2 Auto Scaling.

In my particular use case, I want to be able to inspect an AMI deployment manually before disabling the previous deployment.

Hopefully someone finds this useful, and if you have and feedback please leave a comment or email me.

Overview

I build my AMI's using Packer and Ansible.

@roustem
roustem / list.md
Last active November 11, 2015 07:26
WebCrypto in 1Password for Teams

WebCrypto APIs:

subtle.generateKey
subtle.exportKey
subtle.importKey
subtle.deriveBits
subtle.encrypt
subtle.decrypt
subtle.digest
@roustem
roustem / err.go
Created August 19, 2016 20:36
Go interface issue
package main
import "fmt"
type MyError struct {
Message string
}
func (m *MyError) Error() string {
return m.Message
package main
import "fmt"
type myError struct {
Message string
}
func (m *myError) Error() string {
return "MyError: " + m.Message