Skip to content

Instantly share code, notes, and snippets.

View yehudamakarov's full-sized avatar
🎯
Focusing

Yehuda Makarov yehudamakarov

🎯
Focusing
View GitHub Profile
@yehudamakarov
yehudamakarov / GetAllInstances.cs
Last active June 24, 2019 22:16
[GetAllInstances] Gets a list of the specified type's values from an object.
public static List<T> GetAllInstances<T>(object value) where T : class
{
var exploredObjects = new HashSet<object>();
var found = new List<T>();
FindAllInstances(value, exploredObjects, found);
return found;
}
@yehudamakarov
yehudamakarov / encrypt-decrypt.sh
Created June 24, 2019 22:18
[gcloud] gcloud commands
gcloud kms encrypt --location global \
--keyring test --key quickstart \
--plaintext-file mysecret.txt \
--ciphertext-file mysecret.txt.encrypted
gcloud kms decrypt --location global \
--keyring test --key quickstart \
--ciphertext-file mysecret.txt.encrypted \
--plaintext-file mysecret.txt.decrypted
package main
import "fmt"
func main() {
slc := []int{1,2}
adjustSlice(slc)
fmt.Println(slc)
map1 := make(map[int]int)
adjustMap(map1)
@yehudamakarov
yehudamakarov / roles.sql
Created April 26, 2021 20:46
user permissions in sql
DECLARE @login NVARCHAR(256), @user NVARCHAR(256);
SELECT @login = login_name FROM sys.dm_exec_sessions WHERE session_id = @@SPID;
SELECT @user = d.name
FROM sys.database_principals AS d
INNER JOIN sys.server_principals AS s
ON d.sid = s.sid
WHERE s.name = @login;
@yehudamakarov
yehudamakarov / iis.ps1
Created February 15, 2022 23:31
IIS Stuff
net stop /y was
net start w3svc