Skip to content

Instantly share code, notes, and snippets.

@HelBorn
HelBorn / Startup.cs
Created March 31, 2012 15:33
Adding a program to startup in C#
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using Microsoft.Win32;
namespace RunOnStartup
{
/// <summary>
/// It attempts to write to HKEY_LOCAL_MACHINE first, which will run on startup on all user accounts.
@danpawlik
danpawlik / Setup-GSI-Image.md
Last active May 8, 2024 11:59
Flashing GSI on Xiaomi Mi 11T Pro (vili) treble phhusson

Installation

Steps:

With computer

  1. Unlock bootloader
  2. sudo fastboot --disable-verity --disable-verification flash vbmeta vbmeta.img (stock or google)
  3. sudo fastboot erase system
  4. sudo fastboot flash system Gsi.img
  5. If you have an error in step 5 "not enough space to resize partition": sudo fastboot delete-logical-partition product_b (if fastboot getvar all "current-slot" is a, run: sudo fastboot delete-logical-partition product_a - https://www.droidwin.com/fix-failed-remote-not-enough-space-to-resize-partition/)
@wojteklu
wojteklu / clean_code.md
Last active May 8, 2024 11:58
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active May 8, 2024 11:55
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@mowings
mowings / cron_docker.md
Last active May 8, 2024 11:54
Run cron on docker with job output directed to stdout

You'd like a docker container that runs cron jobs, with the output of those cron jobs going to stdout so they are accessible as docker logs. How do you do that?

Install cron, and set it up to run in the foreground

In your Dockerfile, apt-get -y install cron Use apk or whatever if you are running on alpine or another distribution Set the command or entrypoint in your Dockerfile to run cron 9n the foreground

ENTRYPOINT ["/usr/sbin/cron", "-f"]
@juniz-dm
juniz-dm / group copy.ps1
Created May 8, 2024 11:54 — forked from guyinacube/group copy.ps1
Create mail enabled security group based on O365 Unified group
## Option 1 - This can be used to be prompted for credentials
$UserCredential = Get-Credential
## Option 2 - If you really want to automate the script, you will
## want to hard code the credentials to log into Azure AD.
# $User = "<ADMIN USER>"
# $PWord = ConvertTo-SecureString -String "<PASSWORD>" -AsPlainText -Force
# $UserCredential = New-Object -TypeName "System.Management.Automation.PSCredential" -ArgumentList $User, $PWord
## Create the session to Exchange Online
@ItsWachira
ItsWachira / folder_structure.md
Created May 8, 2024 11:53 — forked from ayoubzulfiqar/folder_structure.md
The Folder Structure for Every Golang Project

Go - The Ultimate Folder Structure

Organizing your Go (Golang) project's folder structure can help improve code readability, maintainability, and scalability. While there is no one-size-fits-all structure, here's a common folder structure for a Go project:

project-root/
    ├── cmd/
    │   ├── your-app-name/
    │   │   ├── main.go         # Application entry point
    │   │   └── ...             # Other application-specific files
@guyinacube
guyinacube / group copy.ps1
Last active May 8, 2024 11:54
Create mail enabled security group based on O365 Unified group
## Option 1 - This can be used to be prompted for credentials
$UserCredential = Get-Credential
## Option 2 - If you really want to automate the script, you will
## want to hard code the credentials to log into Azure AD.
# $User = "<ADMIN USER>"
# $PWord = ConvertTo-SecureString -String "<PASSWORD>" -AsPlainText -Force
# $UserCredential = New-Object -TypeName "System.Management.Automation.PSCredential" -ArgumentList $User, $PWord
## Create the session to Exchange Online
@curran
curran / .gitignore
Last active May 8, 2024 11:53 — forked from enjalot/clone.js
a set of scripts to pull the git history from the d3 git repositories
d3*
data
*.swp
@onnimonni
onnimonni / validate_sha256sum
Last active May 8, 2024 11:53
Shell script to validate file sha256 hashes. I use this to check if downloaded binaries are correct in Dockerfiles. This might make updating harder but at least it you see which parts have been updated since the last run.
#!/bin/sh
##
# This script contains helper for sha256 validating your downloads
#
# Source: https://gist.github.com/onnimonni/b49779ebc96216771a6be3de46449fa1
# Author: Onni Hakala
# License: MIT
##
# Stop program and give error message