Skip to content

Instantly share code, notes, and snippets.

View vitalyisaev2's full-sized avatar

Vitaly Isaev vitalyisaev2

  • Yandex
  • Moscow, Russia
View GitHub Profile
@kylelemons
kylelemons / funcall.go
Created June 6, 2011 15:43
Benchmark function calls
package main
import (
"fmt"
"testing"
)
func readonly() {}
var readwrite = func() {}
#include <iostream>
struct Base {
};
struct D1 : Base {
};
struct D2 : Base {
int a{10};
@WillPlatnick
WillPlatnick / salt-encrypt.sh
Created June 9, 2016 12:18
Encrypt SaltStack Pillars
#!/usr/bin/env bash
# Usage: salt-encrypt {optional -f} <input> <keyid>, or just `salt-encrypt` for interactive mode
# Summary: Encrypt some string / file for Salt
# Help: This command can be used to gpg encrypt some content for use in salt pillars or really anything you want to encrypt with GPG
set -e
#Replace below with the default key you encrypt with
DEFAULT_RECIPIENT="XXXXXX"
multi=0
@Lewiscowles1986
Lewiscowles1986 / FindJemalloc.cmake
Created January 15, 2017 16:35
Find Jemalloc library (CMake)
#
# Find the JEMALLOC client includes and library
#
# This module defines
# JEMALLOC_INCLUDE_DIR, where to find jemalloc.h
# JEMALLOC_LIBRARIES, the libraries to link against
# JEMALLOC_FOUND, if false, you cannot build anything that requires JEMALLOC
# also defined, but not for general use are
@basmussen
basmussen / install_jenkins_plugins.sh
Created December 30, 2013 14:36
Install Jenkins plugins
#!/bin/bash
host=http://localhost:8080
url=/pluginManager/installNecessaryPlugins
# git plugin https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin
curl -X POST -d '<jenkins><install plugin="git@2.0" /></jenkins>' --header 'Content-Type: text/xml' $host$url
# artifactory plugin https://wiki.jenkins-ci.org/display/JENKINS/Artifactory+Plugin
curl -X POST -d '<jenkins><install plugin="artifactory@2.2.1" /></jenkins>' --header 'Content-Type: text/xml' $host$url
@Rubentxu
Rubentxu / maybe.go
Created September 24, 2015 23:34
Implementing the Maybe monad in Golang
package main
import (
"fmt"
"errors"
)
type Maybe interface {
Return(value interface{}) Maybe
Bind(func(interface{}) Maybe) Maybe
@kendellfab
kendellfab / golang-json-marshall
Created August 16, 2013 22:35
Handling custom Json marshalling in golang.
type Whatever struct {
someField int
}
func (w Whatever) MarshalJSON() ([]byte, error) {
return json.Marshal(struct{
SomeField int `json:"some_field"`
}{
SomeField: w.someField,
})
@liu316484231
liu316484231 / personal_access_token.go
Last active November 27, 2021 02:27
Golang Script for obtaining Gitlab API Personal Access Token
/**
* Created by bing at 2019-12-17 08:58
*/
package rscrawler
import (
"github.com/anaskhan96/soup"
"io/ioutil"
"log"
"net/http"
@HelenaEksler
HelenaEksler / check-files-exist-from-list.sh
Last active March 25, 2023 15:11
Bash script to check files in list exist in directory
#!/usr/bin/env bash
#Check Files in list from file exist or doesn't exist in directory.
if [ $# -eq 0 ] || [ $# -eq 1 ]
then
echo "You must pass the path to file with the list and the path to directory to check files. \nsh check-file-exist-from-list.sh path/to/file path/to/directory"
exit 1
fi
while read -r file; do
@SuryaSankar
SuryaSankar / M2M_Association_SQLalchemy.py
Last active September 25, 2023 07:30
An example of a many to many relation via Association Object in SQLAlchemy
import sqlalchemy
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String, ForeignKey
from sqlalchemy.orm import sessionmaker, relationship, backref
from sqlalchemy.ext.associationproxy import association_proxy
import uuid
engine = sqlalchemy.create_engine('sqlite:///:memory:')
Base = declarative_base()