Skip to content

Instantly share code, notes, and snippets.

View otakusid's full-sized avatar
🏠
Working from home

otakuSiD otakusid

🏠
Working from home
View GitHub Profile
@earthgecko
earthgecko / bash.generate.random.alphanumeric.string.sh
Last active June 9, 2024 04:58
shell/bash generate random alphanumeric string
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 32 | head -n 1
@syl20bnr
syl20bnr / robocop.bat
Created December 12, 2012 16:23
robocopy exit codes suck :-)
rem -------------------------------------------------------------------------------
rem this file controls the error level returned by the tool robocopy in order to
rem be usable in a custom build step of Visual Studio
rem -------------------------------------------------------------------------------
robocopy.exe /A-:R /NP /NJH /NJS /NDL /NFL /NS /NC %*
rem if errorlevel 16 echo Robocopy Exit Status: ***FATAL ERROR*** & exit /b 1
rem if errorlevel 15 echo Robocopy Exit Status: FAIL MISM XTRA COPY & exit /b 1
rem if errorlevel 14 echo Robocopy Exit Status: FAIL MISM XTRA & exit /b 1
@dodyg
dodyg / gist:5823184
Last active March 29, 2024 03:59
Kotlin Programming Language Cheat Sheet Part 1

#Intro

Kotlin is a new programming language for the JVM. It produces Java bytecode, supports Android and generates JavaScript. The latest version of the language is Kotlin M5.3

Kotlin project website is at kotlin.jetbrains.org.

All the codes here can be copied and run on Kotlin online editor.

Let's get started.

@sloria
sloria / bobp-python.md
Last active June 8, 2024 23:19
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
@d11wtq
d11wtq / docker-ssh-forward.bash
Created January 29, 2014 23:32
How to SSH agent forward into a docker container
docker run -rm -t -i -v $(dirname $SSH_AUTH_SOCK) -e SSH_AUTH_SOCK=$SSH_AUTH_SOCK ubuntu /bin/bash
@subfuzion
subfuzion / global-gitignore.md
Last active May 29, 2024 12:00
Global gitignore

There are certain files created by particular editors, IDEs, operating systems, etc., that do not belong in a repository. But adding system-specific files to the repo's .gitignore is considered a poor practice. This file should only exclude files and directories that are a part of the package that should not be versioned (such as the node_modules directory) as well as files that are generated (and regenerated) as artifacts of a build process.

All other files should be in your own global gitignore file:

  • Create a file called .gitignore in your home directory and add any filepath patterns you want to ignore.
  • Tell git where your global gitignore file is.

Note: The specific name and path you choose aren't important as long as you configure git to find it, as shown below. You could substitute .config/git/ignore for .gitignore in your home directory, if you prefer.

@magnetikonline
magnetikonline / README.md
Last active June 7, 2023 20:57
AWS Elastic Beanstalk deploy user restricted IAM policy.

AWS Elastic Beanstalk deploy user restricted IAM policy

An IAM user policy document to give minimal rights for deploying an Elastic Beanstalk application.

Where:

  • REGION: AWS region.
  • ACCOUNT_ID: AWS account ID.
  • APPLICATION_NAME: Desired target Elastic Beanstalk application name(space).
  • IAM_INSTANCE_PROFILE_ROLE: The instance profile (IAM role) Elastic Beanstalk EC2 instaces will run under.
@joepie91
joepie91 / vpn.md
Last active June 6, 2024 16:23
Don't use VPN services.

Don't use VPN services.

No, seriously, don't. You're probably reading this because you've asked what VPN service to use, and this is the answer.

Note: The content in this post does not apply to using VPN for their intended purpose; that is, as a virtual private (internal) network. It only applies to using it as a glorified proxy, which is what every third-party "VPN provider" does.

  • A Russian translation of this article can be found here, contributed by Timur Demin.
  • A Turkish translation can be found here, contributed by agyild.
  • There's also this article about VPN services, which is honestly better written (and has more cat pictures!) than my article.
@sumpfgottheit
sumpfgottheit / gunicorn.init.sh
Last active June 5, 2024 02:35
Gunicorn Init Script
#!/bin/sh
#
# gunicorn_pypiserver Startup script for gunicorn for
#
# chkconfig: - 86 14
# processname: gunicorn_pypiserver
# pidfile: /var/run/pypiserver.pid
# description: Python application server for pypiserver
#
### BEGIN INIT INFO
#Importing IIS module to make the IIS:\ Drive available
Import-Module WebAdministration -ErrorAction SilentlyContinue
#Make sure to put the name of your deploy step name inside the Brackets.
$appPool = "IIS:\\AppPools\" + $OctopusParameters['Octopus.Action[YOURDEPLOYSTEPNAME].IISWebSite.ApplicationPoolName']
#Setting the .NET CLR Runtime of the app pool to "" which is the same as "No Managed Code"
Set-ItemProperty $appPool managedRuntimeVersion "" -verbose