Skip to content

Instantly share code, notes, and snippets.

View he-dev's full-sized avatar
😵
ღ(¯`◕‿◕´¯) ♫ ♪ ♫

ᎬᏁᎶᎥᏁᎬᎬᏒ he-dev

😵
ღ(¯`◕‿◕´¯) ♫ ♪ ♫
  • ƃǝɹɯɐnʎ, ɔoןoƃnǝ
View GitHub Profile
@1kastner
1kastner / run_python_script_in_conda_env.bat
Last active March 5, 2024 08:27 — forked from maximlt/run_python_script_in_conda_env.bat
Run a Python script in a conda environment from a batch file
@ECHO OFF
SETLOCAL EnableDelayedExpansion
REM Insert your conda env here
SET CONDA_ENV=MY_DESIRED_CONDA_ENV
CALL :activate_conda_env
REM Insert your python script here
@maximlt
maximlt / run_python_script_in_conda_env.bat
Last active April 1, 2024 06:23
Run a Python script in a conda environment from a batch file
@echo OFF
rem How to run a Python script in a given conda environment from a batch file.
rem It doesn't require:
rem - conda to be in the PATH
rem - cmd.exe to be initialized with conda init
rem Define here the path to your conda installation
set CONDAPATH=C:\ProgramData\Miniconda3
rem Define here the name of the environment
@marcelaraujo
marcelaraujo / README.md
Last active October 14, 2023 18:17
Convert P12 to PEM and extract RSA public and private keys

Convert P12 into PEM

openssl pkcs12 -in google-service-account-key.p12 -nocerts -nodes -out google-service-account-key.pem

openssl pkcs12 -in google-service-account-key.p12 -clcerts -nokeys -out google-service-account-crt.pem

Private RSA key

openssl rsa -in google-service-account-key.pem -out google-service-account-key-rsa

Public RSA key

openssl rsa -in google-service-account-key.pem -out google-service-account-key-rsa.pub -pubout

@exhuma
exhuma / wincred.py
Last active February 26, 2024 10:15 — forked from mrh1997/wincred.py
Retrieve Windows Credential via Python
"""
Access windows credentials
Credentials must be stored in the Windows Credentials Manager in the Control
Panel. This helper will search for "generic credentials" under the section
"Windows Credentials"
Example usage::
result = get_generic_credential('foobar')
@heiswayi
heiswayi / repo-reset.md
Created February 5, 2017 01:32
GitHub - Delete commits history with git commands

First Method

Deleting the .git folder may cause problems in our git repository. If we want to delete all of our commits history, but keep the code in its current state, try this:

# Check out to a temporary branch:
git checkout --orphan TEMP_BRANCH

# Add all the files:
git add -A
@AlexMAS
AlexMAS / ProcessAsyncHelper.cs
Last active April 22, 2024 02:50
The right way to run external process in .NET (async version)
using System;
using System.Diagnostics;
using System.Text;
using System.Threading.Tasks;
public static class ProcessAsyncHelper
{
public static async Task<ProcessResult> ExecuteShellCommand(string command, string arguments, int timeout)
{
var result = new ProcessResult();
@petermorlion
petermorlion / DictionaryJsonConverter
Last active November 12, 2022 16:45
Generic JsonConverter for JSON.NET and IDictionaries
// UPDATE!
// In Json.NET 7, a DictionaryKeyResolver was added.
// This might be able to fix the problem more elegantly.
// I haven't checked though.
public class DictionaryJsonConverter : JsonConverter
{
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
var dictionary = (IDictionary)value;
@max-mapper
max-mapper / 0.md
Last active February 25, 2024 12:24
JS hoisting by example

JavaScript function hoisting by example

Below are many examples of function hoisting behavior in JavaScript. Ones marked as works successfuly print 'hi!' without errors.

To play around with these examples (recommended) clone them with git and execute them with e.g. node a.js

Notes on hoisting

(I may be using incorrect terms below, please forgive me)

@gabceb
gabceb / ConvertXLS.ps1
Created May 3, 2011 22:36
Powershell script to convert all xls documents to xlsx in a folder recursively
$xlFixedFormat = [Microsoft.Office.Interop.Excel.XlFileFormat]::xlOpenXMLWorkbook
write-host $xlFixedFormat
$excel = New-Object -ComObject excel.application
$excel.visible = $true
$folderpath = "C:\Users\gabceb\Documents\testXLS"
$filetype ="*xls"
Get-ChildItem -Path $folderpath -Include $filetype -recurse |
ForEach-Object `
{
$path = ($_.fullname).substring(0, ($_.FullName).lastindexOf("."))